def execute(argv, env=None, cwd=None): if env is None: env = os.environ if is_verbose_mode(): print(' '.join(argv)) try: output = subprocess.check_output(argv, stderr=subprocess.STDOUT, env=env, cwd=cwd) if is_verbose_mode(): print(output) return output except subprocess.CalledProcessError as e: print(e.output) raise e
def execute(argv, env=None, cwd=None): if env is None: env = os.environ if is_verbose_mode(): print ' '.join(argv) try: output = subprocess.check_output(argv, stderr=subprocess.STDOUT, env=env, cwd=cwd) if is_verbose_mode(): print output return output except subprocess.CalledProcessError as e: print e.output raise e
def setup_libchromiumcontent(is_dev, target_arch, url, libcc_source_path, libcc_shared_library_path, libcc_static_library_path): target_dir = os.path.join(DOWNLOAD_DIR, 'libchromiumcontent') script = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script', 'download') args = [ '-f', '-c', get_libchromiumcontent_commit(), '--target_arch', target_arch, url, target_dir ] if (libcc_source_path != None and libcc_shared_library_path != None and libcc_static_library_path != None): args += [ '--libcc_source_path', libcc_source_path, '--libcc_shared_library_path', libcc_shared_library_path, '--libcc_static_library_path', libcc_static_library_path ] mkdir_p(target_dir) else: mkdir_p(DOWNLOAD_DIR) if is_verbose_mode(): args += ['-v'] if is_dev: subprocess.check_call([sys.executable, script] + args) else: subprocess.check_call([sys.executable, script, '-s'] + args)
def start(): log = sys.stdout if is_verbose_mode() else open(os.devnull, 'w') DBusTestCase.start_system_bus() DBusTestCase.spawn_server_template('logind', None, log) DBusTestCase.start_session_bus() DBusTestCase.spawn_server_template('notification_daemon', None, log)
def update_node_modules(dirname, env=None): if env is None: env = os.environ with scoped_cwd(dirname): if is_verbose_mode(): execute_stdout([NPM, 'install', '--verbose'], env) else: execute_stdout([NPM, 'install'], env)
def update_node_modules(dirname, env=None): if env is None: env = os.environ.copy() with scoped_cwd(dirname): args = [NPM, 'install'] if is_verbose_mode(): args += ['--verbose'] execute_stdout(args, env)
def execute_stdout(argv, env=None, cwd=None): if env is None: env = os.environ if is_verbose_mode(): print(' '.join(argv)) try: subprocess.check_call(argv, env=env, cwd=cwd) except subprocess.CalledProcessError as e: print(e.output) raise e else: execute(argv, env, cwd)
def execute_stdout(argv, env=None, cwd=None): if env is None: env = os.environ if is_verbose_mode(): print ' '.join(argv) try: subprocess.check_call(argv, env=env, cwd=cwd) except subprocess.CalledProcessError as e: print e.output raise e else: execute(argv, env, cwd)
def generate_posix_symbols(binary, source_root, build_dir, destination): generate_breakpad_symbols = os.path.join(source_root, 'components', 'crash', 'content', 'tools', 'generate_breakpad_symbols.py') args = [ '--build-dir={0}'.format(build_dir), '--symbols-dir={0}'.format(destination), '--jobs=16', '--binary={0}'.format(binary), ] if is_verbose_mode(): args += ['--verbose'] execute([sys.executable, generate_breakpad_symbols] + args)
def update_node_modules(dirname, env=None): if env is None: env = os.environ if PLATFORM == 'linux': llvm_dir = os.path.join(SOURCE_ROOT, 'vendor', 'llvm-build', 'Release+Asserts', 'bin') env['CC'] = os.path.join(llvm_dir, 'clang') env['CXX'] = os.path.join(llvm_dir, 'clang++') env['npm_config_clang'] = '1' with scoped_cwd(dirname): if is_verbose_mode(): execute_stdout([NPM, 'install', '--verbose'], env) else: execute_stdout([NPM, 'install'], env)
def main(): os.chdir(SOURCE_ROOT) args = parse_args() if args.verbose: enable_verbose_mode() # Update the VS build env. import_vs_env(get_target_arch()) # decide which ninja executable to use ninja_path = args.ninja_path if not ninja_path: ninja_path = os.path.join('vendor', 'depot_tools', 'ninja') if sys.platform == 'win32': ninja_path += '.exe' # decide how to invoke ninja ninja = [ninja_path] if is_verbose_mode(): ninja.append('-v') if args.libcc: if ('D' not in args.configuration or not os.path.exists(GCLIENT_DONE) or not os.path.exists(os.path.join(LIBCC_DIST_MAIN, 'build.ninja'))): sys.stderr.write('--libcc should only be used when ' 'libchromiumcontent was built with bootstrap.py -d ' '--debug_libchromiumcontent' + os.linesep) sys.exit(1) script = os.path.join(LIBCC_SOURCE_ROOT, 'script', 'build') subprocess.check_call([sys.executable, script, '-D', '-t', get_target_arch()]) subprocess.check_call(ninja + ['-C', LIBCC_DIST_MAIN]) env = build_env() for config in args.configuration: build_path = os.path.join('out', config[0]) build_args = ['-C', build_path, args.target] if args.compdb: build_args += ['-t', 'compdb', 'cxx', 'cc'] compdb = open(r'compile_commands.json','w') ret = subprocess.call(ninja + build_args, env=env, stdout=compdb) compdb.close() else: ret = subprocess.call(ninja + build_args, env=env) if ret != 0: sys.exit(ret)
def main(): args = parse_args() if args.verbose: enable_verbose_mode() rm_rf(args.destination) source_root = os.path.abspath(args.source_root) build_path = os.path.join(source_root, args.build_dir) (project_name, product_name) = get_names_from_branding() if PLATFORM in ['darwin', 'linux']: if PLATFORM == 'darwin': #macOS has an additional helper app; provide the path to that binary also main_app = os.path.join(build_path, '{0}.app'.format(product_name), 'Contents', 'MacOS', product_name) helper_name = product_name + " Helper" helper_app = os.path.join(build_path, '{0}.app'.format(helper_name), 'Contents', 'MacOS', product_name + " Helper") binaries = [main_app, helper_app] for binary in binaries: generate_posix_symbols(binary, source_root, build_path, args.destination) else: binary = os.path.join(build_path, project_name) generate_posix_symbols(binary, source_root, build_path, args.destination) else: generate_breakpad_symbols = os.path.join( ELECTRON_ROOT, 'tools', 'win', 'generate_breakpad_symbols.py') args = [ '--symbols-dir={0}'.format(args.destination), '--jobs=16', os.path.relpath(build_path), ] if is_verbose_mode(): args += ['-v'] #Make sure msdia140.dll is in the path (needed for dump_syms.exe) env = os.environ.copy() msdia140_dll_path = os.path.join(GN_SRC_DIR, 'third_party', 'llvm-build', 'Release+Asserts', 'bin') env['PATH'] = os.path.pathsep.join([env.get('PATH', '')] + [msdia140_dll_path]) execute([sys.executable, generate_breakpad_symbols] + args, env)
def main(): args = parse_args() if args.verbose: enable_verbose_mode() rm_rf(args.destination) source_root = os.path.abspath(args.source_root) build_path = os.path.join(source_root, args.build_dir) (project_name, product_name) = get_names_from_branding() if PLATFORM in ['darwin', 'linux']: if PLATFORM == 'darwin': #macOS has an additional helper app; provide the path to that binary also main_app = os.path.join(build_path, '{0}.app'.format(product_name), 'Contents', 'MacOS', product_name) helper_name = product_name + " Helper" helper_app = os.path.join(build_path, '{0}.app'.format(helper_name), 'Contents', 'MacOS', product_name + " Helper") binaries = [main_app, helper_app] for binary in binaries: generate_posix_symbols(binary, source_root, build_path, args.destination) else: binary = os.path.join(build_path, project_name) generate_posix_symbols(binary, source_root, build_path, args.destination) else: generate_breakpad_symbols = os.path.join(ELECTRON_ROOT, 'tools', 'win', 'generate_breakpad_symbols.py') args = [ '--symbols-dir={0}'.format(args.destination), '--jobs=16', os.path.relpath(build_path), ] if is_verbose_mode(): args += ['-v'] #Make sure msdia140.dll is in the path (needed for dump_syms.exe) env = os.environ.copy() msdia140_dll_path = os.path.join(SRC_DIR, 'third_party', 'llvm-build', 'Release+Asserts', 'bin') env['PATH'] = os.path.pathsep.join( [env.get('PATH', '')] + [msdia140_dll_path]) execute([sys.executable, generate_breakpad_symbols] + args, env)
def update_node_modules(dirname, env=None): if env is None: env = os.environ.copy() if PLATFORM == 'linux': # Use prebuilt clang for building native modules. set_clang_env(env) env['npm_config_clang'] = '1' with scoped_cwd(dirname): args = [NPM, 'install'] if is_verbose_mode(): args += ['--verbose'] # Ignore npm install errors when running in CI. if os.environ.has_key('CI'): try: execute_stdout(args, env) except subprocess.CalledProcessError: pass else: execute_stdout(args, env)
def main(): os.chdir(SOURCE_ROOT) args = parse_args() if args.verbose: enable_verbose_mode() # Update the VS build env. import_vs_env(get_target_arch()) # decide which ninja executable to use ninja_path = args.ninja_path if not ninja_path: ninja_path = os.path.join('vendor', 'depot_tools', 'ninja') if sys.platform == 'win32': ninja_path += '.exe' # decide how to invoke ninja ninja = [ninja_path] if is_verbose_mode(): ninja.append('-v') if args.libcc: if ('D' not in args.configuration or not os.path.exists(GCLIENT_DONE) or not os.path.exists(os.path.join(LIBCC_DIST_MAIN, 'build.ninja'))): sys.stderr.write('--libcc should only be used when ' 'libchromiumcontent was built with bootstrap.py -d ' '--debug_libchromiumcontent' + os.linesep) sys.exit(1) script = os.path.join(LIBCC_SOURCE_ROOT, 'script', 'build') subprocess.check_call([sys.executable, script, '-D', '-t', get_target_arch()]) subprocess.check_call(ninja + ['-C', LIBCC_DIST_MAIN]) env = build_env() for config in args.configuration: build_path = os.path.join('out', config[0]) ret = subprocess.call(ninja + ['-C', build_path, args.target], env=env) if ret != 0: sys.exit(ret)
def update_node_modules(dirname, env=None): if env is None: env = os.environ if PLATFORM == 'linux': # Use prebuilt clang for building native modules. llvm_dir = os.path.join(SOURCE_ROOT, 'vendor', 'llvm-build', 'Release+Asserts', 'bin') env['CC'] = os.path.join(llvm_dir, 'clang') env['CXX'] = os.path.join(llvm_dir, 'clang++') env['npm_config_clang'] = '1' with scoped_cwd(dirname): args = [NPM, 'install'] if is_verbose_mode(): args += ['--verbose'] # Ignore npm install errors when running in CI. if os.environ.has_key('CI'): try: execute_stdout(args, env) except subprocess.CalledProcessError: pass else: execute_stdout(args, env)
def setup_libchromiumcontent(is_dev, target_arch, url, libcc_source_path, libcc_shared_library_path, libcc_static_library_path): target_dir = os.path.join(DOWNLOAD_DIR, 'libchromiumcontent') script = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script', 'download') args = ['-f', '-c', get_libchromiumcontent_commit(), '--target_arch', target_arch, url, target_dir] if (libcc_source_path != None and libcc_shared_library_path != None and libcc_static_library_path != None): args += ['--libcc_source_path', libcc_source_path, '--libcc_shared_library_path', libcc_shared_library_path, '--libcc_static_library_path', libcc_static_library_path] mkdir_p(target_dir) else: mkdir_p(DOWNLOAD_DIR) if is_verbose_mode(): args += ['-v'] if is_dev: subprocess.check_call([sys.executable, script] + args) else: subprocess.check_call([sys.executable, script, '-s'] + args)
def update_node_modules(dirname): with scoped_cwd(dirname): if is_verbose_mode(): execute_stdout([NPM, 'install', '--verbose']) else: execute_stdout([NPM, 'install'])