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.')
def install(self, environ, version, strict=False, locally=True): if not self.found: src_dir = self.download(environ, version, strict) if 'windows' in platform.system().lower() or \ (not locally and system_uses_homebrew()): website = ('http://dist.neo4j.org/',) win_ver = version.replace('.', '_') win_arch = 'x32' if struct.calcsize('P') == 8: win_arch = 'x64' global_install('Neo4j', website, winstaller='neo4j-community_windows-' + win_arch + \ '_' + win_ver + '.exe', brew='neo4j', ## no macports, debian or yum packages ) self.environment['NEO4J'] = ['neo4j', 'start'] elif not locally: local_dir = os.path.join(options.target_build_dir, src_dir, 'bin') admin_check_call([os.path.join(local_dir, 'neo4j'), 'install']) else: local_dir = os.path.join(options.target_build_dir, src_dir, 'bin') self.environment['NEO4J'] = [os.path.join(local_dir, 'neo4j'), 'start']
def is_installed(self, environ, version=None, strict=False): options.set_debug(self.debug) self.found = system_uses_homebrew() if self.found: self.brews_found = os.path.exists(python_executable()) and \ os.path.exists(pip_executable()) exe = os.path.realpath(sys.executable) if self.brews_found and \ not exe in python_sys_executables(): switch_python() return self.found and self.brews_found
def install(self, environ, version, strict=False, locally=True): if not self.found: pre = [] post = [] if not locally: if not 'windows' in platform.system().lower() and \ not system_uses_homebrew(): pre.append('sudo') post.append('-g') if self.debug: log = sys.stdout else: log_file = os.path.join(options.target_build_dir, 'node-' + self.module.lower() + '.log') log = open(log_file, 'w') cmd_line = pre + [environ['NPM'], 'update'] + post try: p = subprocess.Popen(cmd_line, stdout=log, stderr=log) status = process_progress(p) except KeyboardInterrupt: p.terminate() log.close() raise if status != 0: log.close() sys.stdout.write(' failed; See ' + log_file) raise ConfigError(self.module, 'NPM update is required, but could not be ' + 'installed; See ' + log_file) cmd_line = pre + [environ['NPM'], 'install', 'node-webgl'] + post try: p = subprocess.Popen(cmd_line, stdout=log, stderr=log) status = process_progress(p) except KeyboardInterrupt: p.terminate() log.close() raise if status != 0: log.close() if log_file: sys.stdout.write(' failed; See ' + log_file) raise ConfigError(self.module, 'Node-' + self.module + ' is required, ' + 'but could not be installed; See ' + log_file) else: sys.stdout.write(' failed') raise ConfigError(self.module, 'Node-' + self.module + ' is required, ' + 'but could not be installed.')
def configure_system( prerequisite_list, version, required_python_version="2.4", install=None, quiet=False, sublevel=None, out=sys.stdout, err=sys.stderr, locally=None, download=None, options=dict(), ): """ Given a list of required software and optionally a Python version, verify that python is the proper version and that other required software is installed. Install missing prerequisites that have an installer defined. """ if locally is None: ## parameter value overrides if "locally" in options.keys(): locally = options["locally"] else: locally = True ## default value if install is None: ## parameter value overrides if "install" in options.keys(): install = options["install"] else: install = True ## default value if download is None: ## parameter value overrides if "download" in options.keys(): download = options["download"] else: download = False ## default value if sublevel is None: ## parameter value overrides if "sublevel" in options.keys(): opts.set_top_level(options["sublevel"]) environment = dict() try: environment = read_cache() skip = False for arg in sys.argv: if arg.startswith("clean"): skip = True quiet = True pyver = simplify_version(platform.python_version()) reqver = simplify_version(required_python_version) if pyver < reqver: raise FatalError("Python version >= " + reqver + " is required. " + "You are running version " + pyver) if not quiet: out.write("CONFIGURE ") if len(environment): out.write("(from cache)") out.write("\n") environment["PACKAGE_VERSION"] = version prerequisite_list.insert(0, "httpsproxy_urllib2") if ( "windows" in platform.system().lower() and in_prerequisites("mingw", prerequisite_list) and in_prerequisites("boost", prerequisite_list) and not in_prerequisites("msvcrt", prerequisite_list) ): err.write("WARNING: if you're using the boost-python DLL, " + "also add 'msvcrt' as a prerequisite.\n") if ( "darwin" in platform.system().lower() and not in_prerequisites("macports", prerequisite_list) and not in_prerequisites("homebrew", prerequisite_list) ): if system_uses_macports(): prerequisite_list.insert(0, "macports") elif system_uses_homebrew(): prerequisite_list.insert(0, "homebrew") else: err.write( "WARNING: neither MacPorts nor Homebrew " + "detected. All required libraries will be " + "built locally.\n" ) for help_name in prerequisite_list: if len(help_name) > 0: environment = find_package_config( help_name, __run_helper__, environment, skip, install, quiet, out, err, locally, download ) save_cache(environment) except Exception: # pylint: disable=W0703 logfile = os.path.join(opts.target_build_dir, "config.log") if not os.path.exists(opts.target_build_dir): mkdir(opts.target_build_dir) log = open(logfile, "a") log.write("** Configuration error. **\n" + traceback.format_exc()) log.close() err.write( "Configuration error; see " + logfile + " for details.\n" + "If the build fails, run 'python setup.py dependencies " + "--show'\nand install the listed packages by hand.\n" ) raise return environment
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.')