def create_symbols_zip(): dist_name = '{0}-{1}-{2}-{3}-symbols.zip'.format(PROJECT_NAME, ELECTRON_VERSION, get_platform_key(), get_target_arch()) zip_file = os.path.join(DIST_DIR, dist_name) licenses = ['LICENSE', 'LICENSES.chromium.html', 'version'] with scoped_cwd(DIST_DIR): dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)] make_zip(zip_file, licenses, dirs) if PLATFORM == 'darwin': dsym_name = '{0}-{1}-{2}-{3}-dsym.zip'.format(PROJECT_NAME, ELECTRON_VERSION, get_platform_key(), get_target_arch()) with scoped_cwd(DIST_DIR): dsyms = glob.glob('*.dSYM') make_zip(os.path.join(DIST_DIR, dsym_name), licenses, dsyms) elif PLATFORM == 'win32': pdb_name = '{0}-{1}-{2}-{3}-pdb.zip'.format(PROJECT_NAME, ELECTRON_VERSION, get_platform_key(), get_target_arch()) with scoped_cwd(DIST_DIR): pdbs = glob.glob('*.pdb') make_zip(os.path.join(DIST_DIR, pdb_name), pdbs + licenses, [])
def main(): print('Zipping Symbols') if get_target_arch() == 'mips64el': return args = parse_args() dist_name = 'symbols.zip' zip_file = os.path.join(args.build_dir, dist_name) licenses = ['LICENSE', 'LICENSES.chromium.html', 'version'] with scoped_cwd(args.build_dir): dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)] print('Making symbol zip: ' + zip_file) make_zip(zip_file, licenses, dirs) if PLATFORM == 'darwin': dsym_name = 'dsym.zip' with scoped_cwd(args.build_dir): dsyms = glob.glob('*.dSYM') dsym_zip_file = os.path.join(args.build_dir, dsym_name) print('Making dsym zip: ' + dsym_zip_file) make_zip(dsym_zip_file, licenses, dsyms) elif PLATFORM == 'win32': pdb_name = 'pdb.zip' with scoped_cwd(args.build_dir): pdbs = glob.glob('*.pdb') pdb_zip_file = os.path.join(args.build_dir, pdb_name) print('Making pdb zip: ' + pdb_zip_file) make_zip(pdb_zip_file, pdbs + licenses, [])
def create_chrome_binary_zip(binary, version): file_suffix = '' create_native_mksnapshot = False if binary == 'mksnapshot': arch = get_target_arch() if arch.startswith('arm'): # if the arch is arm/arm64 the mksnapshot executable is an x64 binary, # so name it as such. file_suffix = 'x64' create_native_mksnapshot = True dist_name = get_zip_name(binary, version, file_suffix) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) files = ['LICENSE', 'LICENSES.chromium.html'] if PLATFORM == 'win32': files += [binary + '.exe'] else: files += [binary] with scoped_cwd(DIST_DIR): make_zip(zip_file, files, []) if create_native_mksnapshot == True: # Create a zip with the native version of the mksnapshot binary. src = os.path.join(NATIVE_MKSNAPSHOT_DIR, binary) dest = os.path.join(DIST_DIR, binary) # Copy file and keep the executable bit. shutil.copyfile(src, dest) os.chmod(dest, os.stat(dest).st_mode | stat.S_IEXEC) dist_name = get_zip_name(binary, version) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): make_zip(zip_file, files, [])
def upload_node(bucket, access_key, secret_key, version): with scoped_cwd(DIST_DIR): s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz')) if TARGET_PLATFORM == 'win32': # Generate the node.lib. build = os.path.join(SOURCE_ROOT, 'script', 'build.py') execute([sys.executable, build, '-c', 'Release', '-t', 'generate_node_lib']) # Upload the 32bit node.lib. node_lib = os.path.join(OUT_DIR, 'node.lib') s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib]) # Upload the fake 64bit node.lib. touch_x64_node_lib() node_lib = os.path.join(OUT_DIR, 'x64', 'node.lib') s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib]) # Upload the index.json with scoped_cwd(SOURCE_ROOT): atom_shell = os.path.join(OUT_DIR, 'atom.exe') index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json')) execute([atom_shell, os.path.join('script', 'dump-version-info.js'), index_json]) s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist', [index_json])
def upload_node(bucket, access_key, secret_key, version): with scoped_cwd(DIST_DIR): s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz')) if TARGET_PLATFORM == 'win32': # Copy atom.lib to node.lib node_lib = os.path.join(OUT_DIR, 'node.lib') atom_lib = os.path.join(OUT_DIR, 'node.dll.lib') shutil.copy2(atom_lib, node_lib) # Upload the 32bit node.lib. s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib]) # Upload the fake 64bit node.lib. touch_x64_node_lib() node_lib = os.path.join(OUT_DIR, 'x64', 'node.lib') s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib]) # Upload the index.json with scoped_cwd(SOURCE_ROOT): atom_shell = os.path.join(OUT_DIR, 'atom.exe') index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json')) execute([atom_shell, os.path.join('script', 'dump-version-info.js'), index_json]) s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist', [index_json])
def main(): parser = optparse.OptionParser() parser.add_option('--inputs', help='GN format list of files to archive.') parser.add_option('--dir-inputs', help='GN format list of files to archive.') parser.add_option('--output', help='Path to output archive.') parser.add_option('--base-dir', help='If provided, the paths in the archive will be ' 'relative to this directory', default='.') options, _ = parser.parse_args() inputs = [] if (options.inputs): parser = gn_helpers.GNValueParser(options.inputs) inputs = parser.ParseList() dir_inputs = [] if options.dir_inputs: parser = gn_helpers.GNValueParser(options.dir_inputs) dir_inputs = parser.ParseList() output = options.output base_dir = options.base_dir with scoped_cwd(base_dir): make_zip(output, inputs, dir_inputs)
def upload_node(bucket, access_key, secret_key, version): with scoped_cwd(DIST_DIR): s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz')) s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), glob.glob('iojs-*.tar.gz')) if PLATFORM == 'win32': if get_target_arch() == 'ia32': node_lib = os.path.join(DIST_DIR, 'node.lib') iojs_lib = os.path.join(DIST_DIR, 'win-x86', 'iojs.lib') else: node_lib = os.path.join(DIST_DIR, 'x64', 'node.lib') iojs_lib = os.path.join(DIST_DIR, 'win-x64', 'iojs.lib') safe_mkdir(os.path.dirname(node_lib)) safe_mkdir(os.path.dirname(iojs_lib)) # Copy atom.lib to node.lib and iojs.lib. atom_lib = os.path.join(OUT_DIR, 'node.dll.lib') shutil.copy2(atom_lib, node_lib) shutil.copy2(atom_lib, iojs_lib) # Upload the node.lib. s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib]) # Upload the iojs.lib. s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), [iojs_lib])
def update_atom_modules(dirname): with scoped_cwd(dirname): apm = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'apm') if sys.platform in ['win32', 'cygwin']: apm = os.path.join(SOURCE_ROOT, 'node_modules', 'atom-package-manager', 'bin', 'apm.cmd') execute_stdout([apm, 'install'])
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 create_dist_zip(): dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION) zip_file = os.path.join(SOURCE_ROOT, "dist", dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[PLATFORM] + ["LICENSE", "LICENSES.chromium.html", "version"] dirs = TARGET_DIRECTORIES[PLATFORM] make_zip(zip_file, files, dirs)
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 create_symbols_zip(): dist_name = "atom-shell-{0}-{1}-{2}-symbols.zip".format(ATOM_SHELL_VERSION, TARGET_PLATFORM, DIST_ARCH) zip_file = os.path.join(SOURCE_ROOT, "dist", dist_name) with scoped_cwd(DIST_DIR): files = ["LICENSE", "version"] dirs = ["Atom-Shell.breakpad.syms"] make_zip(zip_file, files, dirs)
def create_dist_zip(): dist_name = "{0}-{1}-{2}-{3}.zip".format(PROJECT_NAME, ATOM_SHELL_VERSION, get_platform_key(), get_target_arch()) zip_file = os.path.join(SOURCE_ROOT, "dist", dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[PLATFORM] + ["LICENSE", "LICENSES.chromium.html", "version"] dirs = TARGET_DIRECTORIES[PLATFORM] make_zip(zip_file, files, dirs)
def update_atom_modules(dirname): os.environ['ATOM_NODE_VERSION'] = NODE_VERSION[1:] with scoped_cwd(dirname): apm = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'apm') if sys.platform in ['win32', 'cygwin']: apm = os.path.join(SOURCE_ROOT, 'node_modules', 'atom-package-manager', 'bin', 'apm.cmd') execute([apm, 'install'])
def create_dist_zip(): dist_name = 'atom-shell-{0}-{1}.zip'.format(ATOM_SHELL_VRESION, TARGET_PLATFORM) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[TARGET_PLATFORM] + ['LICENSE', 'version'] dirs = TARGET_DIRECTORIES[TARGET_PLATFORM] make_zip(zip_file, files, dirs)
def create_symbols_zip(): dist_name = "{0}-{1}-{2}-{3}-symbols.zip".format( PROJECT_NAME, ATOM_SHELL_VERSION, get_platform_key(), get_target_arch() ) zip_file = os.path.join(DIST_DIR, dist_name) licenses = ["LICENSE", "LICENSES.chromium.html", "version"] with scoped_cwd(DIST_DIR): dirs = ["{0}.breakpad.syms".format(PROJECT_NAME)] make_zip(zip_file, licenses, dirs) if PLATFORM == "darwin": dsym_name = "{0}-{1}-{2}-{3}-dsym.zip".format( PROJECT_NAME, ATOM_SHELL_VERSION, get_platform_key(), get_target_arch() ) with scoped_cwd(DIST_DIR): dsyms = glob.glob("*.dSYM") make_zip(os.path.join(DIST_DIR, dsym_name), licenses, dsyms)
def get_patch(repo, commit_hash): args = ['git', 'diff-tree', '-p', commit_hash, '--' # Explicitly tell Git `commit_hash` is a revision, not a path. ] with scoped_cwd(repo): return subprocess.check_output(args)
def create_symbols_zip(): dist_name = 'atom-shell-{0}-{1}-symbols.zip'.format(ATOM_SHELL_VERSION, TARGET_PLATFORM) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = ['LICENSE', 'version'] dirs = ['Atom-Shell.breakpad.syms'] make_zip(zip_file, files, dirs)
def create_symbols_zip(): dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, "symbols") zip_file = os.path.join(DIST_DIR, dist_name) licenses = ["LICENSE", "LICENSES.chromium.html", "version"] with scoped_cwd(DIST_DIR): dirs = ["{0}.breakpad.syms".format(PROJECT_NAME)] make_zip(zip_file, licenses, dirs) if PLATFORM == "darwin": dsym_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, "dsym") with scoped_cwd(DIST_DIR): dsyms = glob.glob("*.dSYM") make_zip(os.path.join(DIST_DIR, dsym_name), licenses, dsyms) elif PLATFORM == "win32": pdb_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, "pdb") with scoped_cwd(DIST_DIR): pdbs = glob.glob("*.pdb") make_zip(os.path.join(DIST_DIR, pdb_name), pdbs + licenses, [])
def create_dist_zip(): dist_name = "atom-shell-{0}-{1}-{2}.zip".format(ATOM_SHELL_VERSION, TARGET_PLATFORM, DIST_ARCH) zip_file = os.path.join(SOURCE_ROOT, "dist", dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[TARGET_PLATFORM] + ["LICENSE", "version"] if TARGET_PLATFORM == "linux": files += SYSTEM_LIBRARIES dirs = TARGET_DIRECTORIES[TARGET_PLATFORM] make_zip(zip_file, files, dirs)
def create_symbols_zip(): dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'symbols') zip_file = os.path.join(DIST_DIR, dist_name) licenses = ['LICENSE', 'LICENSES.chromium.html', 'version'] with scoped_cwd(DIST_DIR): dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)] make_zip(zip_file, licenses, dirs) if PLATFORM == 'darwin': dsym_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'dsym') with scoped_cwd(DIST_DIR): dsyms = glob.glob('*.dSYM') make_zip(os.path.join(DIST_DIR, dsym_name), licenses, dsyms) elif PLATFORM == 'win32': pdb_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'pdb') with scoped_cwd(DIST_DIR): pdbs = glob.glob('*.pdb') make_zip(os.path.join(DIST_DIR, pdb_name), pdbs + licenses, [])
def create_symbols_zip(): dist_name = '{0}-{1}-{2}-{3}-symbols.zip'.format(PROJECT_NAME, ATOM_SHELL_VERSION, PLATFORM, get_target_arch()) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = ['LICENSE', 'version'] dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)] make_zip(zip_file, files, dirs)
def create_dist_zip(): dist_name = '{0}-{1}-{2}-{3}.zip'.format(PROJECT_NAME, ATOM_SHELL_VERSION, PLATFORM, get_target_arch()) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[PLATFORM] + ['LICENSE', 'version'] if PLATFORM == 'linux': files += [lib for lib in SYSTEM_LIBRARIES if os.path.exists(lib)] dirs = TARGET_DIRECTORIES[PLATFORM] make_zip(zip_file, files, dirs)
def create_chrome_binary_zip(binary, version): dist_name = get_zip_name(binary, version) zip_file = os.path.join(SOURCE_ROOT, "dist", dist_name) with scoped_cwd(DIST_DIR): files = ["LICENSE", "LICENSES.chromium.html"] if PLATFORM == "win32": files += [binary + ".exe"] else: files += [binary] make_zip(zip_file, files, [])
def create_dist_zip(): dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[PLATFORM] + TARGET_BINARIES_EXT + ['LICENSE', 'LICENSES.chromium.html', 'version'] if PLATFORM != 'darwin' and PDF_VIEWER_ENABLED: files += ['pdf_viewer_resources.pak'] dirs = TARGET_DIRECTORIES[PLATFORM] make_zip(zip_file, files, dirs)
def dist_newer_than_head(): with scoped_cwd(SOURCE_ROOT): try: head_time = subprocess.check_output(["git", "log", "--pretty=format:%at", "-n", "1"]).strip() dist_time = os.path.getmtime(os.path.join(DIST_DIR, DIST_NAME)) except OSError as e: if e.errno != errno.ENOENT: raise return False return dist_time > int(head_time)
def create_chrome_binary_zip(binary, version): dist_name = get_zip_name(binary, version) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = ['LICENSE', 'LICENSES.chromium.html'] if PLATFORM == 'win32': files += [binary + '.exe'] else: files += [binary] make_zip(zip_file, files, [])
def create_dist_zip(): dist_name = 'mongoscope-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION, TARGET_PLATFORM, DIST_ARCH) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[TARGET_PLATFORM] + ['LICENSE', 'version'] if TARGET_PLATFORM == 'linux': files += SYSTEM_LIBRARIES dirs = TARGET_DIRECTORIES[TARGET_PLATFORM] make_zip(zip_file, files, dirs)
def create_dist_zip(): dist_name = '{0}-{1}-{2}-{3}.zip'.format(PROJECT_NAME, ELECTRON_VERSION, get_platform_key(), get_target_arch()) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[PLATFORM] + ['LICENSE', 'LICENSES.chromium.html', 'version'] dirs = TARGET_DIRECTORIES[PLATFORM] make_zip(zip_file, files, dirs)
def create_chrome_binary_zip(binary, version): dist_name = "{0}-{1}-{2}-{3}.zip".format(binary, version, get_platform_key(), get_target_arch()) zip_file = os.path.join(SOURCE_ROOT, "dist", dist_name) with scoped_cwd(DIST_DIR): files = ["LICENSE", "LICENSES.chromium.html"] if PLATFORM == "win32": files += [binary + ".exe"] else: files += [binary] make_zip(zip_file, files, [])
def create_dist_zip(): dist_name = '{0}-{1}-{2}-{3}.zip'.format(PROJECT_NAME, ATOM_SHELL_VERSION, get_platform_key(), get_target_arch()) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[PLATFORM] + ['LICENSE', 'version'] if PLATFORM == 'linux': files += [lib for lib in SYSTEM_LIBRARIES if os.path.exists(lib)] dirs = TARGET_DIRECTORIES[PLATFORM] make_zip(zip_file, files, dirs)
def main(): args = parse_args() env = os.environ.copy() with scoped_cwd(WEB_DISCOVERY_DIR): if args.verbose: enable_verbose_mode() if args.install: execute_stdout([NPM, 'install', '--no-save', '--yes'], env=env) if args.build: env["OUTPUT_PATH"] = args.output_path execute_stdout([NPM, 'run', 'build-module'], env=env)
def create_dist_zip(): dist_name = '{0}-{1}-{2}-{3}.zip'.format(PROJECT_NAME, ELECTRON_VERSION, get_platform_key(), get_target_arch()) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[PLATFORM] + [ 'LICENSE', 'LICENSES.chromium.html', 'version' ] dirs = TARGET_DIRECTORIES[PLATFORM] make_zip(zip_file, files, dirs)
def transpile_web_uis(dirname, production, target_gen_dir, env=None): if env is None: env = os.environ.copy() if production: args = [NPM, 'run', 'web-ui'] else: args = [NPM, 'run', 'web-ui-dev'] env["TARGET_GEN_DIR"] = target_gen_dir with scoped_cwd(dirname): execute_stdout(args, env)
def create_dist_zip(): dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = TARGET_BINARIES[PLATFORM] + TARGET_BINARIES_EXT + [ 'LICENSE', 'LICENSES.chromium.html', 'version' ] if PLATFORM != 'darwin' and PDF_VIEWER_ENABLED: files += ['pdf_viewer_resources.pak'] dirs = TARGET_DIRECTORIES[PLATFORM] make_zip(zip_file, files, dirs)
def dist_newer_than_head(): with scoped_cwd(SOURCE_ROOT): try: head_time = subprocess.check_output( ['git', 'log', '--pretty=format:%at', '-n', '1']).strip() dist_time = os.path.getmtime(os.path.join(DIST_DIR, DIST_NAME)) except OSError as e: if e.errno != errno.ENOENT: raise return False return dist_time > int(head_time)
def create_chromedriver_zip(): dist_name = 'chromedriver-{0}-{1}-{2}.zip'.format( get_chromedriver_version(), TARGET_PLATFORM, DIST_ARCH) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = ['LICENSE'] if TARGET_PLATFORM == 'win32': files += ['chromedriver.exe'] else: files += ['chromedriver'] make_zip(zip_file, files, [])
def create_chrome_binary_zip(binary, version): dist_name = '{0}-{1}-{2}-{3}.zip'.format(binary, version, get_platform_key(), get_target_arch()) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) with scoped_cwd(DIST_DIR): files = ['LICENSE', 'LICENSES.chromium.html'] if PLATFORM == 'win32': files += [binary + '.exe'] else: files += [binary] make_zip(zip_file, files, [])
def create_symbols_zip(): if get_target_arch() == 'mips64el': return dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'symbols') zip_file = os.path.join(DIST_DIR, dist_name) licenses = ['LICENSE', 'LICENSES.chromium.html', 'version'] with scoped_cwd(DIST_DIR): dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)] make_zip(zip_file, licenses, dirs) if PLATFORM == 'darwin': dsym_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'dsym') with scoped_cwd(DIST_DIR): dsyms = glob.glob('*.dSYM') make_zip(os.path.join(DIST_DIR, dsym_name), licenses, dsyms) elif PLATFORM == 'win32': pdb_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'pdb') with scoped_cwd(DIST_DIR): pdbs = glob.glob('*.pdb') make_zip(os.path.join(DIST_DIR, pdb_name), pdbs + licenses, [])
def generate_grd(target_include_dir, resource_name, env=None): if env is None: env = os.environ.copy() args = [NPM, 'run', 'web-ui-gen-grd'] env["RESOURCE_NAME"] = resource_name env["ID_PREFIX"] = "IDR_" + resource_name.upper() + '_' env["TARGET_DIR"] = os.path.abspath(target_include_dir) dirname = os.path.abspath(os.path.join(__file__, '..', '..')) with scoped_cwd(dirname): execute_stdout(args, env)
def transpile_web_uis(production, target_gen_dir, env=None): if env is None: env = os.environ.copy() if production: args = [NPM, 'run', 'web-ui'] else: args = [NPM, 'run', 'web-ui-dev'] env["TARGET_GEN_DIR"] = target_gen_dir dirname = os.path.abspath(os.path.join(__file__, '..', '..')) with scoped_cwd(dirname): execute_stdout(args, env)
def main(): if get_target_arch() == 'mips64el': return dist_name = 'symbols.zip' zip_file = os.path.join(OUT_DIR, dist_name) licenses = ['LICENSE', 'LICENSES.chromium.html', 'version'] with scoped_cwd(OUT_DIR): dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)] make_zip(zip_file, licenses, dirs) if PLATFORM == 'darwin': dsym_name = 'dsym.zip' with scoped_cwd(OUT_DIR): dsyms = glob.glob('*.dSYM') make_zip(os.path.join(OUT_DIR, dsym_name), licenses, dsyms) elif PLATFORM == 'win32': pdb_name = 'pdb.zip' with scoped_cwd(OUT_DIR): pdbs = glob.glob('*.pdb') make_zip(os.path.join(OUT_DIR, pdb_name), pdbs + licenses, [])
def main(): print('Zipping Symbols') if get_target_arch() == 'mips64el': return args = parse_args() dist_name = 'symbols.zip' zip_file = os.path.join(args.build_dir, dist_name) licenses = ['LICENSE', 'LICENSES.chromium.html', 'version'] with scoped_cwd(args.build_dir): dirs = ['breakpad_symbols'] print('Making symbol zip: ' + zip_file) make_zip(zip_file, licenses, dirs) if PLATFORM == 'darwin': dsym_name = 'dsym.zip' with scoped_cwd(args.build_dir): dsyms = glob.glob('*.dSYM') dsym_zip_file = os.path.join(args.build_dir, dsym_name) print('Making dsym zip: ' + dsym_zip_file) make_zip(dsym_zip_file, licenses, dsyms) if len(dsyms) > 0 and 'DELETE_DSYMS_AFTER_ZIP' in os.environ: execute(['rm', '-rf'] + dsyms) elif PLATFORM == 'win32': pdb_name = 'pdb.zip' with scoped_cwd(args.build_dir): pdbs = glob.glob('*.pdb') pdb_zip_file = os.path.join(args.build_dir, pdb_name) print('Making pdb zip: ' + pdb_zip_file) make_zip(pdb_zip_file, pdbs + licenses, []) elif PLATFORM == 'linux': debug_name = 'debug.zip' with scoped_cwd(args.build_dir): dirs = ['debug'] debug_zip_file = os.path.join(args.build_dir, debug_name) print('Making debug zip: ' + debug_zip_file) make_zip(debug_zip_file, licenses, dirs)
def main(): if not authToken or authToken == "": raise Exception("Please set META_DUMPER_AUTH_HEADER") # Upload the index.json. with scoped_cwd(ELECTRON_DIR): safe_mkdir(OUT_DIR) index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json')) new_content = get_content() with open(index_json, "w") as f: f.write(new_content) store_artifact(OUT_DIR, 'atom-shell/dist', [index_json])
def commit(repo, author, message): """ Commit whatever in the index is now.""" # Let's setup committer info so git won't complain about it being missing. # TODO: Is there a better way to set committer's name and email? env = os.environ.copy() env['GIT_COMMITTER_NAME'] = 'Anonymous Committer' env['GIT_COMMITTER_EMAIL'] = '*****@*****.**' args = ['git', 'commit', '--author', author, '--message', message] with scoped_cwd(repo): return_code = subprocess.call(args, env=env) committed_successfully = (return_code == 0) return committed_successfully
def main(): # Upload the index.json. with scoped_cwd(SOURCE_ROOT): atom_shell = os.path.join(OUT_DIR, 'atom') if PLATFORM == 'win32': atom_shell += '.exe' index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json')) execute([ atom_shell, os.path.join('tools', 'dump-version-info.js'), index_json ]) bucket, access_key, secret_key = s3_config() s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist', [index_json])
def upload_node(bucket, access_key, secret_key, version): with scoped_cwd(GEN_DIR): generated_tar = os.path.join(GEN_DIR, 'node_headers.tar.gz') for header_tar in HEADER_TAR_NAMES: versioned_header_tar = header_tar.format(version) shutil.copy2(generated_tar, os.path.join(GEN_DIR, versioned_header_tar)) s3put(bucket, access_key, secret_key, GEN_DIR, 'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz')) s3put(bucket, access_key, secret_key, GEN_DIR, 'atom-shell/dist/{0}'.format(version), glob.glob('iojs-*.tar.gz')) if PLATFORM == 'win32': if get_target_arch() == 'ia32': node_lib = os.path.join(DIST_DIR, 'node.lib') iojs_lib = os.path.join(DIST_DIR, 'win-x86', 'iojs.lib') v4_node_lib = os.path.join(DIST_DIR, 'win-x86', 'node.lib') elif get_target_arch() == 'arm64': node_lib = os.path.join(DIST_DIR, 'arm64', 'node.lib') iojs_lib = os.path.join(DIST_DIR, 'win-arm64', 'iojs.lib') v4_node_lib = os.path.join(DIST_DIR, 'win-arm64', 'node.lib') else: node_lib = os.path.join(DIST_DIR, 'x64', 'node.lib') iojs_lib = os.path.join(DIST_DIR, 'win-x64', 'iojs.lib') v4_node_lib = os.path.join(DIST_DIR, 'win-x64', 'node.lib') safe_mkdir(os.path.dirname(node_lib)) safe_mkdir(os.path.dirname(iojs_lib)) # Copy electron.lib to node.lib and iojs.lib. electron_lib = os.path.join(OUT_DIR, 'electron.lib') shutil.copy2(electron_lib, node_lib) shutil.copy2(electron_lib, iojs_lib) shutil.copy2(electron_lib, v4_node_lib) # Upload the node.lib. s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib]) # Upload the iojs.lib. s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), [iojs_lib]) # Upload the v4 node.lib. s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), [v4_node_lib])
def main(): parser = argparse.ArgumentParser() parser.add_argument('--output', help='Path to output archive.') parser.add_argument('--input', help='Path to input archive.') parser.add_argument('--target_dir', help='If provided, the paths in the archive will be ' 'relative to this directory', default='.') args = parser.parse_args() temp_dir = tempdir('brave_archive') lzma_exec = GetLZMAExec() cmd = [lzma_exec, 'x', args.input, '-y', '-o' + temp_dir] subprocess.check_call(cmd, stdout=subprocess.PIPE, shell=False) with scoped_cwd(os.path.join(temp_dir, args.target_dir)): make_zip(args.output, [], ['.'])
def main(): if not authToken or authToken == "": raise Exception("Please set META_DUMPER_AUTH_HEADER") # Upload the index.json. with scoped_cwd(SOURCE_ROOT): safe_mkdir(OUT_DIR) index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json')) new_content = get_content() with open(index_json, "w") as f: f.write(new_content) bucket, access_key, secret_key = s3_config() s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist', [index_json])
def create_ffmpeg_zip(): dist_name = 'ffmpeg-{0}-{1}-{2}.zip'.format( ATOM_SHELL_VERSION, get_platform_key(), get_target_arch()) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) if PLATFORM == 'darwin': ffmpeg_name = 'libffmpeg.dylib' elif PLATFORM == 'linux': ffmpeg_name = 'libffmpeg.so' elif PLATFORM == 'win32': ffmpeg_name = 'ffmpeg.dll' shutil.copy2(os.path.join(CHROMIUM_DIR, '..', 'ffmpeg', ffmpeg_name), DIST_DIR) with scoped_cwd(DIST_DIR): make_zip(zip_file, [ffmpeg_name, 'LICENSE', 'LICENSES.chromium.html'], [])
def apply_patch(repo, patch_path, directory=None, index=False, reverse=False): args = [ 'git', 'apply', '--ignore-space-change', '--ignore-whitespace', '--whitespace', 'fix' ] if directory: args += ['--directory', directory] if index: args += ['--index'] if reverse: args += ['--reverse'] args += ['--', patch_path] with scoped_cwd(repo): return_code = subprocess.call(args) applied_successfully = (return_code == 0) return applied_successfully
def main(): # Upload the index.json. with scoped_cwd(SOURCE_ROOT): if sys.platform == 'darwin': atom_shell = os.path.join(OUT_DIR, '{0}.app'.format(PRODUCT_NAME), 'Contents', 'MacOS', PRODUCT_NAME) elif sys.platform == 'win32': atom_shell = os.path.join(OUT_DIR, '{0}.exe'.format(PROJECT_NAME)) else: atom_shell = os.path.join(OUT_DIR, PROJECT_NAME) index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json')) execute([atom_shell, os.path.join('tools', 'dump-version-info.js'), index_json]) bucket, access_key, secret_key = s3_config() s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist', [index_json])
def main(): if not authToken or authToken == "": raise Exception("Please set META_DUMPER_AUTH_HEADER") # Upload the index.json. with scoped_cwd(SOURCE_ROOT): safe_mkdir(OUT_DIR) index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json')) request = urllib2.Request(BASE_URL + version, headers={"Authorization": authToken}) new_content = urllib2.urlopen(request).read() with open(index_json, "w") as f: f.write(new_content) bucket, access_key, secret_key = s3_config() s3put(bucket, access_key, secret_key, OUT_DIR, 'atom-shell/dist', [index_json])
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(): if len(sys.argv) != 2 or sys.argv[1] == '-h': print 'Usage: bump-version.py [<version> | major | minor | patch]' return 1 option = sys.argv[1] increments = ['major', 'minor', 'patch', 'build'] if option in increments: version = get_electron_version() versions = parse_version(version.split('-')[0]) versions = increase_version(versions, increments.index(option)) else: versions = parse_version(option) version = '.'.join(versions[:3]) with scoped_cwd(SOURCE_ROOT): update_package_json(version) tag_version(version)
def upload_node(bucket, access_key, secret_key, version): with scoped_cwd(DIST_DIR): s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz')) if PLATFORM == 'win32': if get_target_arch() == 'ia32': node_lib = os.path.join(DIST_DIR, 'node.lib') else: node_lib = os.path.join(DIST_DIR, 'x64', 'node.lib') safe_mkdir(os.path.dirname(node_lib)) # Copy atom.lib to node.lib atom_lib = os.path.join(OUT_DIR, 'node.dll.lib') shutil.copy2(atom_lib, node_lib) # Upload the node.lib. s3put(bucket, access_key, secret_key, DIST_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib])
def create_ffmpeg_zip(): dist_name = get_zip_name('ffmpeg', ELECTRON_VERSION) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) if PLATFORM == 'darwin': ffmpeg_name = 'libffmpeg.dylib' elif PLATFORM == 'linux': ffmpeg_name = 'libffmpeg.so' elif PLATFORM == 'win32': ffmpeg_name = 'ffmpeg.dll' shutil.copy2(os.path.join(CHROMIUM_DIR, '..', 'ffmpeg', ffmpeg_name), DIST_DIR) if PLATFORM == 'linux': strip_binary(os.path.join(DIST_DIR, ffmpeg_name)) with scoped_cwd(DIST_DIR): make_zip(zip_file, [ffmpeg_name, 'LICENSE', 'LICENSES.chromium.html'], [])
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 main(): if len(sys.argv) != 2 or sys.argv[1] == '-h': print 'Usage: bump-version.py [<version> | major | minor | patch]' return 1 option = sys.argv[1] increments = ['major', 'minor', 'patch', 'build'] if option in increments: version = get_atom_shell_version() versions = parse_version(version.split('-')[0]) versions = increase_version(versions, increments.index(option)) else: versions = parse_version(option) version = '.'.join(versions[:3]) with scoped_cwd(SOURCE_ROOT): update_atom_gyp(version) update_win_rc(version, versions) update_version_h(versions) update_info_plist(version) tag_version(version)
def upload_node(bucket, access_key, secret_key, version): with scoped_cwd(dist_dir()): s3put(bucket, access_key, secret_key, dist_dir(), 'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz')) s3put(bucket, access_key, secret_key, dist_dir(), 'atom-shell/dist/{0}'.format(version), glob.glob('iojs-*.tar.gz')) if PLATFORM == 'win32': if get_target_arch() != 'x64': node_lib = os.path.join(dist_dir(), 'node.lib') node2_lib = os.path.join(dist_dir(), 'win-x86', 'node.lib') iojs_lib = os.path.join(dist_dir(), 'win-x86', 'iojs.lib') else: node_lib = os.path.join(dist_dir(), 'x64', 'node.lib') node2_lib = os.path.join(dist_dir(), 'win-x64', 'node.lib') iojs_lib = os.path.join(dist_dir(), 'win-x64', 'iojs.lib') safe_mkdir(os.path.dirname(node_lib)) safe_mkdir(os.path.dirname(node2_lib)) safe_mkdir(os.path.dirname(iojs_lib)) # Copy atom.lib to node.lib and iojs.lib. atom_lib = os.path.join(output_dir(), 'node_import.lib') shutil.copy2(atom_lib, node_lib) shutil.copy2(atom_lib, node2_lib) shutil.copy2(atom_lib, iojs_lib) # Upload the node.lib. s3put(bucket, access_key, secret_key, dist_dir(), 'atom-shell/dist/{0}'.format(version), [node_lib]) s3put(bucket, access_key, secret_key, dist_dir(), 'atom-shell/dist/{0}'.format(version), [node2_lib]) # Upload the iojs.lib. s3put(bucket, access_key, secret_key, dist_dir(), 'atom-shell/dist/{0}'.format(version), [iojs_lib])