예제 #1
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    if os.path.isdir('/usr/lib/python2.7/dist-packages/pyassimp'):
        logging.info('Linking pyassimp on ubuntu...')
        ln('/usr/lib/python2.7/dist-packages/pyassimp', 
           os.path.join(robustus.env, 'lib/python2.7/site-packages/pyassimp'), force = True)
    else:
        raise RequirementException('System-wide pyassimp is missing, run: sudo apt-get install python-pyassimp')
예제 #2
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    install_dir = robustus.install_cmake_package(
        requirement_specifier, ['-DENABLE_TESTS_COMPILATION:BOOL=False'],
        ignore_index)

    # required gazebo executables
    executables = [
        'gazebo', 'gzserver', 'gzclient', 'gzfactory', 'gzlog', 'gzsdf',
        'gzstats', 'gztopic'
    ]

    # fix rpaths for binaries
    lib_dir = os.path.join(install_dir, 'lib')
    binaries = glob.glob(os.path.join(install_dir, 'lib/*.so*'))
    for executable in executables:
        binaries += glob.glob(
            os.path.join(install_dir, 'bin/' + executable + '*'))
    for binary in binaries:
        if os.path.isfile(binary) and not os.path.islink(binary):
            fix_rpath(robustus, robustus.env, binary, lib_dir)

    # make symlinks
    for executable in executables:
        executable_path = os.path.join(install_dir, 'bin', executable)
        ln(executable_path, os.path.join(robustus.env, 'bin', executable))
예제 #3
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # Softlinking to existing PyGObject. TODO: install via configure
    if os.path.isdir('/usr/lib/python2.7/dist-packages/gobject'):
        logging.info('Linking PyGObject')
        site_packages_dir = os.path.join(robustus.env, 'lib/python2.7/site-packages')
        files = ['gobject']
        for f in files:
            src = os.path.join('/usr/lib/python2.7/dist-packages', f)
            if not os.path.exists(src):
                raise RequirementException('Required packages for system-wide PyGObject missing, %s not found' % f)
            ln(src, os.path.join(site_packages_dir, f), force=True)
    else:
        raise RequirementException('System-wide PyGObject is missing')
예제 #4
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # Create links to system-wide PySide
    if sys.platform.startswith('darwin'):
        if os.path.isfile('/usr/local/lib/python2.7/site-packages/PySide/QtCore.so'):
            logging.info('Linking pyside on macos')
            ln('/usr/local/lib/python2.7/site-packages/sip.so',
                os.path.join(robustus.env, 'lib/python2.7/site-packages/sip.so'), force = True)
            ln('/usr/local/lib/python2.7/site-packages/PySide',
                os.path.join(robustus.env, 'lib/python2.7/site-packages/PySide'), force = True)
        else:
            raise RequirementException('System-wide PySide is missing, run: brew install pyside')   
    else:
        candidates = ['/usr/lib64/python2.7/site-packages/',
                      '/usr/lib/python2.7/dist-packages',
                      '/usr/local/lib/python2.7/dist-packages']
        for c in candidates:
            if os.path.isfile(os.path.join(c, 'PySide/QtCore.so')):
                logging.info('Linking pyside in %s' % c)
                ln(os.path.join(c, 'sip.so'),
                    os.path.join(robustus.env, 'lib/python2.7/site-packages/sip.so'), force = True)
                ln(os.path.join(c, 'PySide'),
                    os.path.join(robustus.env, 'lib/python2.7/site-packages/PySide'), force = True)
                break
        else:
            raise RequirementException('System-wide PySide is missing, run: sudo apt-get install python-pyside'
                                       'Recently we removed pyside compilation on travis because it just takes 25 minutes'
                                       'and does not lead to any benefits.'
                                       'Please add "- sudo apt-get install -y --force-yes python-pyside" to your .travis.yml')
예제 #5
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # check if already installed
    sphinxbase = os.path.join(robustus.env, 'lib/python2.7/site-packages/sphinxbase.so')
    if os.path.isfile(sphinxbase):
        return

    cwd = os.getcwd()
    archive = None
    try:
        # build in cache
        os.chdir(robustus.cache)
        build_dir = os.path.join(robustus.cache, 'sphinxbase-%s' % requirement_specifier.version)
        if not os.path.isfile(os.path.join(build_dir, 'configure')):
            archive = robustus.download('sphinxbase', requirement_specifier.version)
            unpack(archive)

        # unfortunately we can't cache sphinxbase, it has to be rebuild after reconfigure
        logging.info('Building sphinxbase')
        os.chdir(build_dir)

        # link python-config from system-wide installation, sphinxbase configure requires it
        python_config = os.path.join(robustus.env, 'bin/python-config')
        if not os.path.isfile(python_config):
            ln('/usr/bin/python-config', python_config)

        retcode = run_shell('./configure'
                            + (' --prefix=%s' % robustus.env)
                            + (' --with-python=%s' % os.path.join(robustus.env, 'bin/python')),
                            shell=True,
                            verbose=robustus.settings['verbosity'] >= 1)
        if retcode != 0:
            raise RequirementException('sphinxbase configure failed')

        retcode = run_shell('make clean && make', shell=True, verbose=robustus.settings['verbosity'] >= 1)
        if retcode != 0:
            raise RequirementException('sphinxbase build failed')

        logging.info('Installing sphinxbase into virtualenv')
        retcode = run_shell('make install', shell=True, verbose=robustus.settings['verbosity'] >= 1)
        if retcode != 0:
            raise RequirementException('sphinxbase install failed')

        fix_rpath(robustus, robustus.env, sphinxbase, os.path.join(robustus.env, 'lib'))
    except RequirementException:
        safe_remove(build_dir)
    finally:
        if archive is not None:
            safe_remove(archive)
        os.chdir(cwd)
예제 #6
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # Softlinking to existing PyGObject. TODO: install via configure
    if os.path.isdir('/usr/lib/python2.7/dist-packages/gobject'):
        logging.info('Linking PyGObject')
        site_packages_dir = os.path.join(robustus.env,
                                         'lib/python2.7/site-packages')
        files = ['gobject']
        for f in files:
            src = os.path.join('/usr/lib/python2.7/dist-packages', f)
            if not os.path.exists(src):
                raise RequirementException(
                    'Required packages for system-wide PyGObject missing, %s not found'
                    % f)
            ln(src, os.path.join(site_packages_dir, f), force=True)
    else:
        raise RequirementException('System-wide PyGObject is missing')
예제 #7
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # Softlinking to existing PyGtk. TODO: install via configure
    if os.path.isfile('/usr/lib/python2.7/dist-packages/pygtk.py'):
        logging.info('Linking pygtk')
        site_packages_dir = os.path.join(robustus.env, 'lib/python2.7/site-packages')
        files = ['pygtk.py', 'pygtk.pyc', 'gtk-2.0', 'glib', 'gobject', 'cairo']
        for f in files:
            src = os.path.join('/usr/lib/python2.7/dist-packages', f)
            if not os.path.exists(src):
                raise RequirementException('Required packages for system-wide PyGtk missing, %s not found' % f)
            ln(src, os.path.join(site_packages_dir, f), force=True)
        pygtk_pth = os.path.join(site_packages_dir, 'pygtk.pth')
        if not os.path.exists(pygtk_pth):
            write_file(os.path.join(pygtk_pth),
                       'w',
                       os.path.join(site_packages_dir, 'gtk-2.0'))
    else:
        raise RequirementException('System-wide PyGtk is missing')   
예제 #8
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    if requirement_specifier.version != '0.10':
        raise RequirementException('Only 0.10 version of pygst is supported')

    # Softlinking to existing gst
    if os.path.isfile('/usr/lib/python2.7/dist-packages/pygst.py'):
        logging.info('Linking pygst')
        site_packages_dir = os.path.join(robustus.env, 'lib/python2.7/site-packages')
        files = ['pygst.py', 'gst-0.10', 'gstoption.so', 'glib', 'gobject']
        for f in files:
            src = os.path.join('/usr/lib/python2.7/dist-packages', f)
            if not os.path.exists(src):
                raise RequirementException('Required packages for system-wide pygst missing, %s not found' % f)
            ln(src, os.path.join(site_packages_dir, f), force=True)
        write_file(os.path.join(site_packages_dir, 'pygst.pth'),
                   'w',
                   os.path.join(site_packages_dir, 'gst-0.10'))
    else:
        raise RequirementException('System-wide pygst is missing')   
예제 #9
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # If we are not on Travis, we only link to system-wide PySide (for now), and return
    # The reason we do this hack for now is to avoid installing qt sdk on bstem
    # So, on bstem and linux machines we will need to sudo apt-get install python-pyside
    # On Mac machines: to be updated soon! 
    if 'TRAVIS' not in os.environ: 
        # Create links to system-wide PySide
        if sys.platform.startswith('darwin'):
            if os.path.isfile('/usr/local/lib/python2.7/site-packages/PySide/QtCore.so'):
                logging.info('Linking pyside on macos')
                ln('/usr/local/lib/python2.7/site-packages/sip.so',
                    os.path.join(robustus.env, 'lib/python2.7/site-packages/sip.so'), force = True)
                ln('/usr/local/lib/python2.7/site-packages/PySide',
                    os.path.join(robustus.env, 'lib/python2.7/site-packages/PySide'), force = True)
            else:
                raise RequirementException('System-wide PySide is missing, run: brew install pyside')   
        else:
            candidates = ['/usr/lib64/python2.7/site-packages/',
                          '/usr/lib/python2.7/dist-packages',
                          '/usr/local/lib/python2.7/dist-packages']
            for c in candidates:
                if os.path.isfile(os.path.join(c, 'PySide/QtCore.so')):
                    logging.info('Linking pyside in %s' % c)
                    ln(os.path.join(c, 'sip.so'),
                        os.path.join(robustus.env, 'lib/python2.7/site-packages/sip.so'), force = True)
                    ln(os.path.join(c, 'PySide'),
                        os.path.join(robustus.env, 'lib/python2.7/site-packages/PySide'), force = True)
                    break
            else:
                raise RequirementException('System-wide PySide is missing, run: sudo apt-get install python-pyside')
    else:
        # If we are on Travis, then:
        # Install through wheeling
        robustus.install_through_wheeling(requirement_specifier, rob_file, ignore_index)
    
        # Need links to shared libraries
        pyside_setup_dir = os.path.join(robustus.cache, 'pyside-setup-master')
        if not os.path.isdir(pyside_setup_dir) and not ignore_index:
            os.chdir(robustus.cache)
            pyside_setup_archive = robustus.download('pyside-setup', 'master')
            unpack(pyside_setup_archive)
    
        cwd = os.getcwd()
        try:
            # run postinstall
            if not os.path.isdir(pyside_setup_dir):
                raise RequirementException('can\'t find pyside-%s in robustus cache' % requirement_specifier.version)
            os.chdir(pyside_setup_dir)
            retcode = subprocess.call([robustus.python_executable, 'pyside_postinstall.py', '-install'])
            if retcode != 0:
                raise RequirementException('failed to execute pyside postinstall script')
        finally:
            os.chdir(cwd)
예제 #10
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    install_dir = robustus.install_cmake_package(requirement_specifier,
                                                 ['-DENABLE_TESTS_COMPILATION:BOOL=False'],
                                                 ignore_index)

    # required gazebo executables
    executables = ['gazebo', 'gzserver', 'gzclient', 'gzfactory', 'gzlog', 'gzsdf', 'gzstats', 'gztopic']

    # fix rpaths for binaries
    lib_dir = os.path.join(install_dir, 'lib')
    binaries = glob.glob(os.path.join(install_dir, 'lib/*.so*'))
    for executable in executables:
        binaries += glob.glob(os.path.join(install_dir, 'bin/' + executable + '*'))
    for binary in binaries:
        if os.path.isfile(binary) and not os.path.islink(binary):
            fix_rpath(robustus, robustus.env, binary, lib_dir)

    # make symlinks
    for executable in executables:
        executable_path = os.path.join(install_dir, 'bin', executable)
        ln(executable_path, os.path.join(robustus.env, 'bin', executable))
예제 #11
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    if requirement_specifier.version != '0.10':
        raise RequirementException('Only 0.10 version of pygst is supported')

    # Softlinking to existing gst
    if os.path.isfile('/usr/lib/python2.7/dist-packages/pygst.py'):
        logging.info('Linking pygst')
        site_packages_dir = os.path.join(robustus.env,
                                         'lib/python2.7/site-packages')
        files = ['pygst.py', 'gst-0.10', 'gstoption.so', 'glib', 'gobject']
        for f in files:
            src = os.path.join('/usr/lib/python2.7/dist-packages', f)
            if not os.path.exists(src):
                raise RequirementException(
                    'Required packages for system-wide pygst missing, %s not found'
                    % f)
            ln(src, os.path.join(site_packages_dir, f), force=True)
        write_file(os.path.join(site_packages_dir, 'pygst.pth'), 'w',
                   os.path.join(site_packages_dir, 'gst-0.10'))
    else:
        raise RequirementException('System-wide pygst is missing')
예제 #12
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # If we are not on Travis, we only link to system-wide PySide (for now), and return
    # The reason we do this hack for now is to avoid installing qt sdk on bstem
    # So, on bstem and linux machines we will need to sudo apt-get install python-sip
    # On Mac machines use brew
    assert 'TRAVIS' not in os.environ
    # Create links to system-wide PySide
    if sys.platform.startswith('darwin'):
        if os.path.isfile('/usr/local/lib/python2.7/site-packages/sipconfig.py'):
            logging.info('Linking sipconfig on macos')
            files_to_link = ['sipconfig.py', 'sip.so', 'sipdistutils.py']
            for f in files_to_link:
                ln(os.path.join('/usr/local/lib/python2.7/site-packages/', f),
                   os.path.join(robustus.env, 'lib/python2.7/site-packages/', f),
                   force = True)
        else:
            raise RequirementException('System-wide SIP is missing, run: brew install sip')  
    elif sys.platform.startswith('linux'):
        if os.path.isfile('/usr/lib/python2.7/dist-packages/sipconfig.py'):
            logging.info('Linking SIP on Linux')
            ln('/usr/lib/python2.7/dist-packages/sipconfig.py',
               os.path.join(robustus.env, 'lib/python2.7/site-packages/sipconfig.py'),
               force = True)
            ln('/usr/lib/python2.7/dist-packages/sipconfig_nd.py',
               os.path.join(robustus.env, 'lib/python2.7/site-packages/sipconfig_nd.py'),
               force = True)
        else:
            raise RequirementException('System-wide SIP is missing, run: sudo apt-get install python-sip')
    else:
        raise RequirementException('SIP not supported on this platform')
예제 #13
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # Softlinking to existing PyGtk. TODO: install via configure
    if os.path.isfile('/usr/lib/python2.7/dist-packages/pygtk.py'):
        logging.info('Linking pygtk')
        site_packages_dir = os.path.join(robustus.env,
                                         'lib/python2.7/site-packages')
        files = [
            'pygtk.py', 'pygtk.pyc', 'gtk-2.0', 'glib', 'gobject', 'cairo'
        ]
        for f in files:
            src = os.path.join('/usr/lib/python2.7/dist-packages', f)
            if not os.path.exists(src):
                raise RequirementException(
                    'Required packages for system-wide PyGtk missing, %s not found'
                    % f)
            ln(src, os.path.join(site_packages_dir, f), force=True)
        pygtk_pth = os.path.join(site_packages_dir, 'pygtk.pth')
        if not os.path.exists(pygtk_pth):
            write_file(os.path.join(pygtk_pth), 'w',
                       os.path.join(site_packages_dir, 'gtk-2.0'))
    else:
        raise RequirementException('System-wide PyGtk is missing')
예제 #14
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # Create links to system-wide PySide
    if sys.platform.startswith('darwin'):
        if os.path.isfile(
                '/usr/local/lib/python2.7/site-packages/PySide/QtCore.so'):
            logging.info('Linking pyside on macos')
            ln('/usr/local/lib/python2.7/site-packages/sip.so',
               os.path.join(robustus.env,
                            'lib/python2.7/site-packages/sip.so'),
               force=True)
            ln('/usr/local/lib/python2.7/site-packages/PySide',
               os.path.join(robustus.env,
                            'lib/python2.7/site-packages/PySide'),
               force=True)
        else:
            raise RequirementException(
                'System-wide PySide is missing, run: brew install pyside')
    else:
        candidates = [
            '/usr/lib64/python2.7/site-packages/',
            '/usr/lib/python2.7/dist-packages',
            '/usr/local/lib/python2.7/dist-packages'
        ]
        for c in candidates:
            if os.path.isfile(os.path.join(c, 'PySide/QtCore.so')):
                logging.info('Linking pyside in %s' % c)
                ln(os.path.join(c, 'sip.so'),
                   os.path.join(robustus.env,
                                'lib/python2.7/site-packages/sip.so'),
                   force=True)
                ln(os.path.join(c, 'PySide'),
                   os.path.join(robustus.env,
                                'lib/python2.7/site-packages/PySide'),
                   force=True)
                break
        else:
            raise RequirementException(
                'System-wide PySide is missing, run: sudo apt-get install python-pyside'
                'Recently we removed pyside compilation on travis because it just takes 25 minutes'
                'and does not lead to any benefits.'
                'Please add "- sudo apt-get install -y --force-yes python-pyside" to your .travis.yml'
            )
예제 #15
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # We only link to system-wide PySide (for now), and return
    # The reason we do this hack for now is to avoid installing qt sdk on bstem
    # So, on bstem and linux machines we will need to sudo apt-get install python-sip
    # On Mac machines use brew
    # Create links to system-wide PySide
    if sys.platform.startswith('darwin'):
        if os.path.isfile(
                '/usr/local/lib/python2.7/site-packages/sipconfig.py'):
            logging.info('Linking sipconfig on macos')
            files_to_link = ['sipconfig.py', 'sip.so', 'sipdistutils.py']
            for f in files_to_link:
                ln(os.path.join('/usr/local/lib/python2.7/site-packages/', f),
                   os.path.join(robustus.env, 'lib/python2.7/site-packages/',
                                f),
                   force=True)
        else:
            raise RequirementException(
                'System-wide SIP is missing, run: brew install sip')
    elif sys.platform.startswith('linux'):
        if os.path.isfile('/usr/lib/python2.7/dist-packages/sipconfig.py'):
            logging.info('Linking SIP on Linux')
            ln('/usr/lib/python2.7/dist-packages/sipconfig.py',
               os.path.join(robustus.env,
                            'lib/python2.7/site-packages/sipconfig.py'),
               force=True)
            ln('/usr/lib/python2.7/dist-packages/sipconfig_nd.py',
               os.path.join(robustus.env,
                            'lib/python2.7/site-packages/sipconfig_nd.py'),
               force=True)
        else:
            raise RequirementException(
                'System-wide SIP is missing, run: sudo apt-get install python-sip'
            )
    else:
        raise RequirementException('SIP not supported on this platform')
예제 #16
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # If we are not on Travis, we only link to system-wide PyQt (for now), and return
    # The reason we do this hack for now is to avoid installing qt sdk on bstem
    # So, on bstem and linux machines we will need to sudo apt-get install python-pyside
    # Create links to system-wide PySide
    if sys.platform.startswith("darwin"):
        if os.path.isfile("/usr/local/lib/python2.7/site-packages/PyQt4/QtCore.so"):
            logging.info("Linking PyQt4 on macos")
            ln(
                "/usr/local/lib/python2.7/site-packages/sip.so",
                os.path.join(robustus.env, "lib/python2.7/site-packages/sip.so"),
                force=True,
            )
            ln(
                "/usr/local/lib/python2.7/site-packages/PyQt4",
                os.path.join(robustus.env, "lib/python2.7/site-packages/PyQt4"),
                force=True,
            )
        else:
            raise RequirementException("System-wide PyQt4 is missing, run: brew install PyQt4")
    else:
        if os.path.isfile("/usr/lib64/python2.7/site-packages/PyQt4/QtCore.so"):
            logging.info("Linking PyQt4 on centos")
            ln(
                "/usr/lib64/python2.7/site-packages/sip.so",
                os.path.join(robustus.env, "lib/python2.7/site-packages/sip.so"),
                force=True,
            )
            ln(
                "/usr/lib64/python2.7/site-packages/PyQt4",
                os.path.join(robustus.env, "lib/python2.7/site-packages/PyQt4"),
                force=True,
            )
        elif os.path.isfile("/usr/lib/python2.7/dist-packages/PyQt4/QtCore.so"):
            logging.info("Linking PyQt4 on ubuntu")
            ln(
                "/usr/lib/python2.7/dist-packages/sip.so",
                os.path.join(robustus.env, "lib/python2.7/site-packages/sip.so"),
                force=True,
            )
            ln(
                "/usr/lib/python2.7/dist-packages/PyQt4",
                os.path.join(robustus.env, "lib/python2.7/site-packages/PyQt4"),
                force=True,
            )
        else:
            raise RequirementException("System-wide PySide is missing, run: sudo apt-get install python-pyside")
예제 #17
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    cwd = os.getcwd()
    os.chdir(robustus.cache)

    install_dir = os.path.join(robustus.cache,
                               'protobuf-%s' % requirement_specifier.version)

    # try to download precompiled protobuf from the remote cache first
    if not os.path.isdir(install_dir) and not ignore_index:
        protobuf_archive = robustus.download_compiled_archive(
            'protobuf', requirement_specifier.version)
        if protobuf_archive is not None:
            unpack(protobuf_archive)
            logging.info('Initializing compiled protobuf')
            # install into wheelhouse
            if not os.path.exists(install_dir):
                raise RequirementException(
                    "Failed to unpack precompiled protobuf archive")

    if not os.path.isdir(install_dir) and not ignore_index:
        archive_name = 'protobuf-%s.tar.gz' % requirement_specifier.version
        if os.path.exists(archive_name):
            safe_remove(archive_name)
        # move sources to a folder in order to use a clean name for installation
        src_dir = 'protobuf-%s' % requirement_specifier.version
        if os.path.exists(src_dir):
            safe_remove(src_dir)
        run_shell([
            'wget',
            'https://protobuf.googlecode.com/svn/rc/%s' % (archive_name, )
        ],
                  verbose=robustus.settings['verbosity'] >= 1)
        run_shell(['tar', 'zxvf', archive_name],
                  verbose=robustus.settings['verbosity'] >= 1)

        if os.path.exists(src_dir + '_src'):
            safe_remove(src_dir + '_src')

        shutil.move(src_dir, src_dir + '_src')
        src_dir += '_src'

        os.chdir(src_dir)
        if os.path.exists(install_dir):
            safe_remove(install_dir)
        os.mkdir(install_dir)

        retcode = run_shell([
            './configure', '--disable-shared', 'CFLAGS=-fPIC',
            'CXXFLAGS=-fPIC', '--prefix', install_dir
        ],
                            verbose=robustus.settings['verbosity'] >= 1)

        if retcode:
            raise RequirementException(
                'Failed to configure protobuf compilation')
        retcode = run_shell('make',
                            shell=True,
                            verbose=robustus.settings['verbosity'] >= 1)
        if retcode:
            raise RequirementException('Failed compile protobuf')

        retcode = run_shell('make install', shell=True)
        if retcode:
            raise RequirementException('Failed install protobuf')

        os.chdir(robustus.cache)
        shutil.rmtree(src_dir)

    venv_install_folder = os.path.join(robustus.env, 'protobuf')
    if os.path.exists(venv_install_folder):
        safe_remove(venv_install_folder)
    shutil.copytree(install_dir, venv_install_folder)
    executable_path = os.path.join(install_dir, 'bin', 'protoc')
    ln(executable_path,
       os.path.join(robustus.env, 'bin', 'protoc'),
       force=True)
    os.chdir(cwd)

    # now install python part
    robustus.install_through_wheeling(requirement_specifier, rob_file,
                                      ignore_index)
예제 #18
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    # If we are not on Travis, we only link to system-wide PyQt (for now), and return
    # The reason we do this hack for now is to avoid installing qt sdk on bstem
    # So, on bstem and linux machines we will need to sudo apt-get install python-pyside
    # Create links to system-wide PySide
    if sys.platform.startswith('darwin'):
        if os.path.isfile('/usr/local/lib/python2.7/site-packages/PyQt4/QtCore.so'):
            logging.info('Linking PyQt4 on macos')
            ln('/usr/local/lib/python2.7/site-packages/sip.so',
                os.path.join(robustus.env, 'lib/python2.7/site-packages/sip.so'), force = True)
            ln('/usr/local/lib/python2.7/site-packages/PyQt4',
                os.path.join(robustus.env, 'lib/python2.7/site-packages/PyQt4'), force = True)
        else:
            raise RequirementException('System-wide PyQt4 is missing, run: brew install PyQt4')   
    else:
        if os.path.isfile('/usr/lib64/python2.7/site-packages/PyQt4/QtCore.so'):
            logging.info('Linking PyQt4 on centos')
            ln('/usr/lib64/python2.7/site-packages/sip.so',
                os.path.join(robustus.env, 'lib/python2.7/site-packages/sip.so'), force = True)
            ln('/usr/lib64/python2.7/site-packages/PyQt4',
                os.path.join(robustus.env, 'lib/python2.7/site-packages/PyQt4'), force = True)
        elif os.path.isfile('/usr/lib/python2.7/dist-packages/PyQt4/QtCore.so'):
            logging.info('Linking PyQt4 on ubuntu')
            ln('/usr/lib/python2.7/dist-packages/sip.so',
                os.path.join(robustus.env, 'lib/python2.7/site-packages/sip.so'), force = True)
            ln('/usr/lib/python2.7/dist-packages/PyQt4',
                os.path.join(robustus.env, 'lib/python2.7/site-packages/PyQt4'), force = True)
        else:
            raise RequirementException('System-wide PySide is missing, run: sudo apt-get install python-pyside')
예제 #19
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    if requirement_specifier.version != '1.8.1' and not requirement_specifier.version.startswith('bc'):
        raise RequirementException('can only install panda3d 1.8.1/bc1/bc2')

    panda_install_dir = os.path.join(robustus.cache, 'panda3d-%s' % requirement_specifier.version)

    def in_cache():
        return os.path.isfile(os.path.join(panda_install_dir, 'lib/panda3d.py'))

    if not in_cache() and not ignore_index:
        cwd = os.getcwd()
        panda3d_tgz = None
        panda3d_archive_name = None
        try:
            panda3d_tgz = robustus.download('panda3d', requirement_specifier.version)
            panda3d_archive_name = unpack(panda3d_tgz)

            logging.info('Builduing panda3d')
            os.chdir(panda3d_archive_name)

            # link bullet into panda dependencies dir
            bullet_installations = glob.glob(os.path.join(robustus.env, 'lib/bullet-*'))
            if len(bullet_installations) > 0:
                bullet_dir = bullet_installations[0]
                if sys.platform.startswith('darwin'):
                    panda_thirdparty_dir = 'thirdparty/darwin-libs-a'
                elif sys.platform.startswith('linux'):
                    panda_thirdparty_dir = 'thirdparty/linux-libs-x64'
                else:
                    raise RequirementException('unsupported platform ' + sys.platform)
                os.mkdir('thirdparty')
                os.mkdir(panda_thirdparty_dir)
                os.mkdir(os.path.join(panda_thirdparty_dir, 'bullet'))
                ln(os.path.join(bullet_dir, 'include/bullet'),
                   os.path.join(panda_thirdparty_dir, 'bullet/include'))
                ln(os.path.join(bullet_dir, 'lib'),
                   os.path.join(panda_thirdparty_dir, 'bullet/lib'))

            make_panda_options = ['--nothing',
                                  '--use-python',
                                  '--use-direct',
                                  '--use-bullet',
                                  '--use-zlib',
                                  '--use-png',
                                  '--use-jpeg',
                                  '--use-tiff',
                                  '--use-freetype',
                                  '--use-x11',
                                  '--use-gl',
                                  '--use-nvidiacg',
                                  '--use-pandatool',
                                  '--use-tinydisplay',
                                  '--threads', '4']
            if sys.platform.startswith('darwin'):
                make_panda_options += ['--use-cocoa']
                os.environ['CC'] = 'gcc'
                os.environ['CXX'] = 'g++'

            makepanda_cmd = [robustus.python_executable, 'makepanda/makepanda.py'] + make_panda_options
            # command takes much time and output very long, so run_shell isn't used
            retcode = subprocess.call(makepanda_cmd)
            if retcode != 0:
                raise RequirementException('panda3d build failed')

            # copy panda3d files to cache
            shutil.rmtree(panda_install_dir, ignore_errors=True)
            os.mkdir(panda_install_dir)
            subprocess.call('cp -R built/lib %s' % panda_install_dir, shell=True)
            subprocess.call('cp -R built/bin %s' % panda_install_dir, shell=True)
            subprocess.call('cp -R built/include %s' % panda_install_dir, shell=True)
            subprocess.call('cp -R built/direct %s' % panda_install_dir, shell=True)
            subprocess.call('cp -R built/pandac %s' % panda_install_dir, shell=True)
            subprocess.call('cp -R built/models %s' % panda_install_dir, shell=True)
            subprocess.call('cp -R built/etc %s' % panda_install_dir, shell=True)
        finally:
            safe_remove(panda3d_tgz)
            safe_remove(panda3d_archive_name)
            os.chdir(cwd)

    if in_cache():
        # install panda3d to virtualenv
        libdir = os.path.join(robustus.env, 'lib/panda3d')
        shutil.rmtree(libdir, ignore_errors=True)
        os.mkdir(libdir)

        env_etcdir = os.path.join(robustus.env, 'etc')
        if not os.path.isdir(env_etcdir):
            os.mkdir(env_etcdir)
        etcdir = os.path.join(env_etcdir, 'panda3d')
        shutil.rmtree(etcdir, ignore_errors=True)
        os.mkdir(etcdir)

        run_shell('cp -r -p %s/lib/* %s/' % (panda_install_dir, libdir), shell=True)
        run_shell('cp -r -p %s/direct %s/' % (panda_install_dir, libdir), shell=True)
        run_shell('cp -r -p %s/pandac %s/' % (panda_install_dir, libdir), shell=True)
        run_shell('cp -r -p %s/etc/* %s/' % (panda_install_dir, etcdir), shell=True)

        # modify rpath of libs
        libdir = os.path.abspath(libdir)
        if sys.platform.startswith('darwin'):
            libs = glob.glob(os.path.join(libdir, '*.dylib'))
        else:
            libs = glob.glob(os.path.join(libdir, '*.so'))
        for lib in libs:
            fix_rpath(robustus, robustus.env, lib, libdir)

        prc_dir_setup = "import os; os.environ['PANDA_PRC_DIR'] = '%s'" % etcdir
        write_file(os.path.join(robustus.env, 'lib/python2.7/site-packages/panda3d.pth'),
                   'w',
                   '%s\n%s\n' % (libdir, prc_dir_setup))

        # patch panda prc file
        with open(os.path.join(etcdir, 'Config.prc'), 'a') as f:
            extra_options = []
            extra_options.append("# enable antialiasing\n"
                                 "framebuffer-multisample 1\n"
                                 "multisamples 4\n")
            extra_options.append("# disable panda3d transform caching to avoid memory leak in bullet bindings\n"
                                 "garbage-collect-states 0\n")

            extra_options.append("# enable software rendering as fallback\n"
                                 "aux-display p3tinydisplay\n")

            f.write('\n'.join(extra_options))

    else:
        raise RequirementException('can\'t find panda3d-%s in robustus cache' % requirement_specifier.version)
예제 #20
0
def install(robustus, requirement_specifier, rob_file, ignore_index):
    cwd = os.getcwd()
    os.chdir(robustus.cache)

    install_dir = os.path.join(robustus.cache, 'protobuf-%s' % requirement_specifier.version)

    # try to download precompiled protobuf from the remote cache first
    if not os.path.isdir(install_dir) and not ignore_index:
        protobuf_archive = robustus.download_compiled_archive('protobuf', requirement_specifier.version)
        if protobuf_archive is not None:
            unpack(protobuf_archive)
            logging.info('Initializing compiled protobuf')
            # install into wheelhouse
            if not os.path.exists(install_dir):
                raise RequirementException("Failed to unpack precompiled protobuf archive")

    if not os.path.isdir(install_dir) and not ignore_index:
        archive_name = 'protobuf-%s.tar.gz' % requirement_specifier.version
        if os.path.exists(archive_name):
            safe_remove(archive_name)
        # move sources to a folder in order to use a clean name for installation
        src_dir = 'protobuf-%s' % requirement_specifier.version
        if os.path.exists(src_dir):
            safe_remove(src_dir)
        run_shell(['wget', 'https://protobuf.googlecode.com/svn/rc/%s' % (archive_name,)],
                  verbose=robustus.settings['verbosity'] >= 1)
        run_shell(['tar', 'zxvf', archive_name],
                  verbose=robustus.settings['verbosity'] >= 1)

        if os.path.exists(src_dir+'_src'):
            safe_remove(src_dir+'_src')

        shutil.move(src_dir, src_dir+'_src')
        src_dir += '_src'

        os.chdir(src_dir)
        if os.path.exists(install_dir):
            safe_remove(install_dir)
        os.mkdir(install_dir)

        retcode = run_shell(['./configure', '--disable-shared',
                             'CFLAGS=-fPIC',
                             'CXXFLAGS=-fPIC',
                             '--prefix', install_dir],
                            verbose=robustus.settings['verbosity'] >= 1)

        if retcode:
            raise RequirementException('Failed to configure protobuf compilation')
        retcode = run_shell('make', shell=True,
                            verbose=robustus.settings['verbosity'] >= 1)
        if retcode:
            raise RequirementException('Failed compile protobuf')

        retcode = run_shell('make install', shell=True)
        if retcode:
            raise RequirementException('Failed install protobuf')

        os.chdir(robustus.cache)
        shutil.rmtree(src_dir)

    venv_install_folder = os.path.join(robustus.env, 'protobuf')
    if os.path.exists(venv_install_folder):
        safe_remove(venv_install_folder) 
    shutil.copytree(install_dir, venv_install_folder)
    executable_path = os.path.join(install_dir, 'bin', 'protoc')
    ln(executable_path, os.path.join(robustus.env, 'bin', 'protoc'), force=True)
    os.chdir(cwd)

    # now install python part
    robustus.install_through_wheeling(requirement_specifier, rob_file, ignore_index)