def install(self, environ, version, strict=False, locally=True): ## always locally, o.w. won't work locally = True if not self.found: src_dir = self.download(environ, version, strict) if options.VERBOSE: sys.stdout.write('PREREQUISITE pyjamas ') working_dir = os.path.join(options.target_build_dir, src_dir) if not os.path.exists(working_dir): os.rename(glob.glob(os.path.join(options.target_build_dir, '*pyjs*'))[0], working_dir) ## Unique two-step installation log_file = os.path.join(options.target_build_dir, 'pyjamas.log') log = open(log_file, 'w') here = os.path.abspath(os.getcwd()) os.chdir(working_dir) cmd_line = [sys.executable, 'bootstrap.py',] try: p = subprocess.Popen(cmd_line, stdout=log, stderr=log) status = process_progress(p) except KeyboardInterrupt: p.terminate() log.close() raise self.check_install(status, log, log_file) cmd_line = [sys.executable, 'run_bootstrap_first_then_setup.py', 'build'] if not locally: sudo_prefix = [] if not as_admin(): sudo_prefix = ['sudo'] cmd_line = sudo_prefix + cmd_line + ['install'] try: p = subprocess.Popen(cmd_line, stdout=log, stderr=log) status = process_progress(p) log.close() except KeyboardInterrupt: p.terminate() log.close() raise self.check_install(status, log, log_file) if options.VERBOSE: sys.stdout.write(' done\n') os.chdir(here) search_path = [] if locally: search_path.append(working_dir) self.environment['PYJSBUILD'] = find_program('pyjsbuild', search_path)
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 install_pypkg_process(cmd_line, environ, log, shell): try: p = subprocess.Popen(cmd_line, env=environ, stdout=log, stderr=log, shell=shell) status = process_progress(p) log.close() except KeyboardInterrupt: p.terminate() log.close() raise return status