def autotools_install_without_fetch(environ, src_dir, locally=True, extra_cfg=None, addtnl_env=None): if extra_cfg is None: extra_cfg = [] if addtnl_env is None: addtnl_env = dict() 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 prefix = convert2unixpath(prefix) ## MinGW shell strips backslashes build_dir = os.path.join(options.target_build_dir, src_dir) ## build in-place mkdir(build_dir) os.chdir(build_dir) log = open('build.log', 'w') try: if 'windows' in platform.system().lower(): ## Assumes MinGW present, detected, and loaded in environment if not os.path.exists('configure'): mingw_check_call(environ, ['autoreconf', '-i'], stdout=log, stderr=log) mingw_check_call(environ, ['./configure', '--prefix="' + prefix + '"'] + extra_cfg, stdout=log, stderr=log, addtnl_env=addtnl_env) mingw_check_call(environ, ['make'], stdout=log, stderr=log, addtnl_env=addtnl_env) try: mingw_check_call(environ, ['make', 'install'], stdout=log, stderr=log, addtnl_env=addtnl_env) except subprocess.CalledProcessError: pass else: os_environ = os.environ.copy() os_environ = dict(list(os_environ.items()) + list(addtnl_env.items())) if not os.path.exists('configure'): check_call(['autoreconf', '-i'], stdout=log, stderr=log) check_call(['./configure', '--prefix=' + prefix] + extra_cfg, stdout=log, stderr=log, env=os_environ) check_call(['make'], stdout=log, stderr=log, env=os_environ) try: if locally: check_call(['make', 'install'], stdout=log, stderr=log, env=os_environ) else: admin_check_call(['make', 'install'], stdout=log, stderr=log, addtnl_env=addtnl_env) except subprocess.CalledProcessError: pass finally: log.close() os.chdir(here)
def install(self, environ, version, strict=False, locally=True): if not self.found: self.download(environ, version, strict) header_file = "f2c.h" shutil.copy(os.path.join(options.download_dir, header_file), options.target_build_dir) self.environment["F2C_INCLUDE_DIR"] = options.target_build_dir prefix = os.path.abspath(options.target_build_dir) if not prefix in options.local_search_paths: options.add_local_search_path(prefix)
def install(self, environ, version, strict=False, locally=True): if not self.found: src_dir = self.download(environ, version, strict) install_pypkg_without_fetch('ctypesgen', src_dir=src_dir, locally=locally) if locally: prefix = os.path.abspath(options.target_build_dir) if not prefix in options.local_search_paths: options.add_local_search_path(prefix) if not self.is_installed(environ, version, strict): raise Exception('ctypesgen installation failed.')
def install(self, environ, version, strict=False, locally=True): if not self.found: if locally or not 'darwin' in platform.system().lower(): 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 ## MinGW shell strips backslashes prefix = convert2unixpath(prefix) src_dir = self.download(environ, version, strict) oper_sys = 'linux' if 'windows' in platform.system().lower(): oper_sys = 'mingw' elif 'darwin' in platform.system().lower(): oper_sys = 'macosx' build_dir = os.path.join(options.target_build_dir, src_dir) os.chdir(build_dir) log = open('build.log', 'w') if 'windows' in platform.system().lower(): try: ## ncurses prerequisite check_call(['mingw-get', 'install', 'pdcurses']) check_call(['mingw-get', 'install', 'libpdcurses']) except subprocess.CalledProcessError: pass mingw_check_call(environ, ['make', 'OS=mingw', 'ENV=gnu', 'all'], stdout=log, stderr=log) mingw_check_call(environ, ['make', 'INSTALLDIR=' + prefix, 'install'], stdout=log, stderr=log) else: check_call(['make', 'OS=' + oper_sys, 'ENV=gnu', 'all'], stdout=log, stderr=log) if locally: check_call(['make', 'INSTALLDIR=' + prefix, 'install'], stdout=log, stderr=log) else: admin_check_call(['make', 'INSTALLDIR=' + prefix, 'install'], stdout=log, stderr=log) log.close() os.chdir(here) else: global_install('CDF', None, brew='cdf', port='cdf') if not self.is_installed(environ, version, strict): raise Exception('CDF installation failed.')
def install(self, environ, version, strict=False, locally=True): if not self.found: if locally or 'windows' in platform.system().lower(): ## NB: broken on Windows! 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 prefix = convert2unixpath(prefix) ## MinGW shell strips backslashes build_dir = os.path.join(options.target_build_dir, src_dir, '_build') mkdir(build_dir) os.chdir(build_dir) log = open('build.log', 'w') if 'windows' in platform.system().lower(): # Assumes MinGW present, detected, and loaded in environment mingw_check_call(environ, ['../configure', '--prefix="' + prefix + '"', '--shared', #'-O ', '-b 32', '-Si nocygin 1'], stdout=log, stderr=log) mingw_check_call(environ, ['make'], stdout=log, stderr=log) mingw_check_call(environ, ['make', 'install'], stdout=log, stderr=log) else: check_call(['../configure', '--prefix=' + prefix, '--shared'], stdout=log, stderr=log) check_call(['make'], stdout=log, stderr=log) if locally: check_call(['make', 'install'], stdout=log, stderr=log) else: admin_check_call(['make', 'install'], stdout=log, stderr=log) log.close() os.chdir(here) else: global_install('ATLAS', None, ## part of XCode deb='libatlas-dev', rpm='atlas-devel') if not self.is_installed(environ, version, strict): raise Exception('ATLAS installation failed.')
def install(self, environ, version, strict=False, locally=True): if not self.found: if version is None: version = '5.16.3' website = ('http://www.perl.org/',) if locally and not 'windows' in platform.system().lower(): sys.stderr.write('Perl was not found, ' + 'but should be already installed by default.' + '\nInstalling locally anyway.\n') ## MinGW build is *not* straight-forward - hence not implemented website = ('http://www.cpan.org/', 'src/' + version.split('.')[0] + '.0/') src_dir = 'perl-' + str(version) archive = src_dir + '.tar.gz' fetch(''.join(website), archive, archive) unarchive(archive, src_dir) 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 here = os.path.abspath(os.getcwd()) os.chdir(options.target_build_dir) log = open('build.log', 'w') check_call(['./Configure', '-des', '-Dprefix=' + prefix], stdout=log, stderr=log) check_call(['make'], stdout=log, stderr=log) check_call(['make', 'install'], stdout=log, stderr=log) log.close() os.chdir(here) else: if 'darwin' in platform.system().lower(): raise Exception('Perl is included with OSX. What happened?') if 'windows' in platform.system().lower(): website = ('http://strawberry-perl.googlecode.com/', 'files/') version = '5.16.2.2' global_install('Perl', website, 'strawberry-perl-' + str(version) + '-32bit.msi', deb='libperl-dev', rpm='perl-devel') if not self.is_installed(environ, version, strict): raise Exception('Perl installation failed.')
def install(self, environ, version, strict=False, locally=True): if not self.found: if 'windows' in platform.system().lower(): 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 ## MinGW shell strips backslashes prefix = convert2unixpath(prefix) website = ('http://dlfcn-win32.googlecode.com/files/',) if version is None: version = 'r19' src_dir = 'dlfcn-win32-' + str(version) archive = src_dir + '.tar.bz2' fetch(''.join(website), archive, archive) unarchive(archive, src_dir) build_dir = os.path.join(options.target_build_dir, src_dir) os.chdir(build_dir) log = open('build.log', 'w') patch_c_only_header('dlfcn.h') mingw_check_call(environ, ['./configure', '--prefix="' + prefix + '"', '--libdir="' + prefix + '/lib"', '--incdir="' + prefix + '/include"', '--enable-shared'], stdout=log, stderr=log) mingw_check_call(environ, ['make'], stdout=log, stderr=log) mingw_check_call(environ, ['make', 'install'], stdout=log, stderr=log) log.close() os.chdir(here) else: raise Exception('Non-Windows platform with missing libdl.') if not self.is_installed(environ, version, strict): raise Exception('libdl installation failed.')
def install(self, environ, version, strict=False, locally=True): if not self.found: if locally or ('darwin' in platform.system().lower() and system_uses_homebrew()): 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 ## MinGW shell strips backslashes prefix = convert2unixpath(prefix) src_dir = 'gccxml' if not os.path.exists(os.path.join(here, options.download_dir, src_dir)): os.chdir(options.download_dir) gitsite = 'https://github.com/gccxml/gccxml.git' check_call([environ['GIT'], 'clone', gitsite, src_dir]) os.chdir(here) build_dir = os.path.join(options.download_dir, src_dir, '_build') mkdir(build_dir) os.chdir(build_dir) log = open('build.log', 'w') if 'windows' in platform.system().lower(): if 'MSVC' in environ: config_cmd = [environ['CMAKE'], '..', '-G', '"NMake Makefiles"', '-DCMAKE_INSTALL_PREFIX=' + prefix] #TODO test msvc cmake build; probably wrong check_call([environ['MSVC_VARS']], stdout=log, stderr=log) check_call(config_cmd, stdout=log, stderr=log) check_call([environ['NMAKE']], stdout=log, stderr=log) check_call([environ['NMAKE'], 'install'], stdout=log, stderr=log) else: ## MinGW config_cmd = [environ['CMAKE'], '..', '-G', '"MSYS Makefiles"', '-DCMAKE_INSTALL_PREFIX=' + prefix, '-DCMAKE_MAKE_PROGRAM=/bin/make.exe'] mingw_check_call(environ, config_cmd, stdout=log, stderr=log) mingw_check_call(environ, ['make'], stdout=log, stderr=log) mingw_check_call(environ, ['make', 'install'], stdout=log, stderr=log) else: config_cmd = [environ['CMAKE'], '..', '-G', 'Unix Makefiles', '-DCMAKE_INSTALL_PREFIX=' + prefix] check_call(config_cmd, stdout=log, stderr=log) check_call(['make'], stdout=log, stderr=log) if locally: check_call(['make', 'install'], stdout=log, stderr=log) else: admin_check_call(['make', 'install'], stdout=log, stderr=log) log.close() os.chdir(here) else: if version is None: version = '0.6.0' website = ('http://www.gccxml.org/', 'files/v' + major_minor_version(version) + '/') global_install('GCCXML', website, winstaller='gccxml-' + str(version) + '-win32.exe', brew=None, port='gccxml-devel', deb='gccxml', rpm='gccxml') if not self.is_installed(environ, version, strict): raise Exception('GCC-XML installation failed.')
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.")