def install_deps(): clean_node_modules() exec_command = ['npm', 'install', '--save-dev'] for pkg, version in DEPS.items(): # For git URLs we append the url rather than package@version, since the package@version # formulation doesn't work. if version.find(u'git+') == 0: exec_command.append('%s' % version) else: exec_command.append('%s@%s' % (pkg, version)) errors_found = False npm_proc_result = subprocess.check_call(exec_command, cwd=devtools_paths.root_path()) if npm_proc_result != 0: errors_found = True # If npm fails, bail here, otherwise attempt to strip private fields. if errors_found: return True errors_found = strip_private_fields() if errors_found: return True errors_found = remove_package_json_entries() return errors_found
def exec_command(cmd): try: cmd_proc_result = subprocess.check_call(cmd, cwd=devtools_paths.root_path()) except CalledProcessError as error: print(error.output) return True return False
def exec_command(cmd): try: cmd_proc_result = subprocess.check_call(cmd, cwd=devtools_paths.root_path()) except Exception as error: print(error) return True return False
def exec_command(cmd): try: new_env = os.environ.copy() # Prevent large files from being checked in to git. new_env["PUPPETEER_SKIP_CHROMIUM_DOWNLOAD"] = "true" cmd_proc_result = subprocess.check_call(cmd, cwd=devtools_paths.root_path(), env=new_env) except Exception as error: print(error) return True return False
if not is_cygwin: return filepath return re.sub(r'^/cygdrive/(\w)', '\\1:', filepath) def to_platform_path_exact(filepath): if not is_cygwin: return filepath output, _ = popen(['cygpath', '-w', filepath]).communicate() # pylint: disable=E1103 return output.strip().replace('\\', '\\\\') DEVTOOLS_PATH = devtools_paths.devtools_root_path() SCRIPTS_PATH = path.join(DEVTOOLS_PATH, 'scripts') ROOT_PATH = devtools_paths.root_path() BROWSER_PROTOCOL_PATH = devtools_paths.browser_protocol_path() # TODO(dgozman): move these checks to v8. JS_PROTOCOL_PATH = path.join(ROOT_PATH, 'v8', 'include', 'js_protocol.pdl') DEVTOOLS_FRONTEND_PATH = path.join(DEVTOOLS_PATH, 'front_end') GLOBAL_EXTERNS_FILE = to_platform_path( path.join(DEVTOOLS_FRONTEND_PATH, 'externs.js')) DEFAULT_PROTOCOL_EXTERNS_FILE = path.join(DEVTOOLS_FRONTEND_PATH, 'protocol_externs.js') WASM_SOURCE_MAP_FILE = path.join(DEVTOOLS_FRONTEND_PATH, 'sdk', 'wasm_source_map', 'types.js') RUNTIME_FILE = to_platform_path(path.join(DEVTOOLS_FRONTEND_PATH, 'Runtime.js')) ROOT_MODULE_FILE = to_platform_path( path.join(DEVTOOLS_FRONTEND_PATH, 'root.js'))
scripts_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(scripts_path) import devtools_paths package_info = json.load( urllib.urlopen('https://registry.npmjs.org/puppeteer/latest')) url = package_info['dist']['tarball'] file = urllib.urlretrieve(url, filename=None)[0] tar = tarfile.open(file, 'r:gz') members = [ member for member in tar.getmembers() if not member.name.startswith('package/lib/cjs/') ] path = devtools_paths.root_path() + '/front_end/third_party/puppeteer' shutil.rmtree(path + '/package') tar.extractall(path=path, members=members) members = [m.name for m in members] def getStartAndEndIndexForGNVariable(content, variable): startIndex = None endIndex = None startPattern = re.compile(r'\s*' + variable + '\s*=\s*\[\s*') endPattern = re.compile(r'\s*\]\s*') for i, line in enumerate(content): if startPattern.match(line): startIndex = i + 1 break