コード例 #1
0
 def install(self, environ, version, strict=False, locally=True):
     if not self.found:
         if version is None:
             version = self.version
         short_ver = '.'.join(version.split('.')[:2])
         py_ver = ''.join(get_python_version())
         brew_extra = ''
         win_extra = '32'
         if platform.architecture()[0] == '64bit':
             brew_extra = ' --devel'
             win_extra = '64'
         website = ('http://sourceforge.net/projects/wxpython/',
                    'files/wxPython/' + str(version) + '/')
         ## NOTE: no local install due to complex platform dependencies
     
         global_install('wxPython', website,
                        winstaller='wxPython' + short_ver + '-win' + \
                            win_extra + '-' + str(version) + '-py' + \
                            py_ver + '.exe',
                        brew='--python wxmac' + brew_extra,
                        port='py' + py_ver + '-wxpython',
                        deb='python-wxgtk python-wxtools',
                        rpm='wxPython-devel')
         if system_uses_homebrew():
             target = os.path.join(homebrew_prefix(), 'lib',
                                    'python'+'.'.join(get_python_version()),
                                    'site-packages', 'wx')
             if not os.path.exists(target):
                 os.symlink(glob.glob(os.path.join(homebrew_prefix(), 'lib',
                                                   'python2.6',
                                                   'site-packages',
                                                   'wx-*', 'wx'))[0], target)
                    
         if not self.is_installed(environ, version, strict):
             raise Exception('wxpython installation failed.')
コード例 #2
0
ファイル: boost.py プロジェクト: sean-m-brennan/pysysdevel
    def install(self, environ, version, strict=False, locally=True):
        if not self.found:
            if locally or "windows" in platform.system().lower():
                src_dir = self.download(environ, version, strict)

                here = os.path.abspath(os.getcwd())
                if locally:
                    prefix = os.path.abspath(options.target_build_dir)
                    if not prefix in options.local_search_paths:
                        options.add_local_search_path(prefix)
                else:
                    prefix = options.global_prefix

                os.chdir(os.path.join(options.target_build_dir, src_dir))
                log = open("build.log", "w")
                err = open("build.errors", "w")
                ## unique build process
                if "windows" in platform.system().lower():
                    os_environ = os.environ.copy()
                    new_path = (
                        os_environ["PATH"]
                        + os.path.join(environ["MINGW_DIR"], "bin")
                        + ";"
                        + os.path.join(environ["MSYS_DIR"], "bin")
                        + ";"
                    )
                    os_environ["PATH"] = new_path.encode("ascii", "ignore")
                    cmd_line = "bootstrap.bat mingw"
                    # cmd_line = 'bootstrap.bat msvc'
                    p = subprocess.Popen(cmd_line, env=os_environ, stdout=log, stderr=err)
                    status = p.wait()
                    if status != 0:
                        raise subprocess.CalledProcessError(status, cmd_line)
                    toolset = "toolset=gcc"
                    # toolset = 'toolset=msvc'
                    cmd_line = (
                        "bjam.exe install link=shared link=static "
                        + toolset
                        + " variant=release threading=single "
                        + '--prefix="'
                        + prefix
                        + '"'
                    )
                    p = subprocess.Popen(cmd_line, env=os_environ, stdout=log, stderr=err)
                    status = p.wait()
                    if status != 0:
                        raise subprocess.CalledProcessError(status, cmd_line)
                else:
                    check_call(["./bootstrap.sh"], stdout=log, stderr=err)
                    subprocess.call(["./bjam", "install", "--prefix=" + prefix], stdout=log, stderr=err)
                    ## may return an error even if everything built
                log.close()
                err.close()
                os.chdir(here)
            else:
                global_install(
                    "Boost",
                    None,
                    brew="boost",
                    port="boost +python" + "".join(get_python_version()),
                    deb="libboost-dev",
                    rpm="boost-devel",
                )
            if not self.is_installed(environ, version, strict):
                raise Exception("Boost installation failed.")