def Main(): """Zip input arguments to Zip output archive.""" (options, args) = ParseCommandLine() # Test that all the input files exist before we blow the output archive away # only to fail part way. for path in args: if path == _DEBUG_ONLY_FILE_SEPARATOR: continue if not os.path.exists(path): raise Exception('Input file does not exist:', path) if os.path.isdir(path): raise Exception('Input file is a path:', path) ignore_extensions = options.ignore_extensions.split(',') # Set up variable substitution mapping. variable_files = [options.version_file, options.branding_file] subst_values = version.fetch_values(variable_files) # Open the output file. if options.input: shutil.copyfile(options.input, options.output) mode = 'a' else: mode = 'w' output = zipfile.ZipFile(options.output, mode, zipfile.ZIP_DEFLATED) # Add the files to the output archive. for path in args: if path == _DEBUG_ONLY_FILE_SEPARATOR: if options.config != 'Debug': break else: dest_path = path if options.path: dest_path = os.path.join(options.path, os.path.basename(path)) extension = os.path.splitext(path)[1] if extension: extension = extension[1:] if extension in ignore_extensions: output.write(path, dest_path) else: contents = version.subst_file(path, subst_values) output.writestr(dest_path, contents) output.close() return 0
def GetVersion(): '''Returns the chrome version string.''' filename = os.path.join(_CHROME_SOURCE_DIR, 'chrome', 'VERSION') values = version.fetch_values([filename]) return version.subst_template('@MAJOR@.@MINOR@.@BUILD@.@PATCH@', values)
def getChromeVersion(version_file): values = version.fetch_values([version_file]) return version.subst_template('@MAJOR@.@MINOR@.@BUILD@.@PATCH@', values)