def main(): """The main function.""" options = ParseOptions() required_flags = ["version_file", "output", "input", "build_dir", "gen_out_dir", "auto_updater_dir", "build_type"] for flag in required_flags: if getattr(options, flag) is None: logging.error("--%s is not specified." % flag) exit(-1) version = mozc_version.MozcVersion(options.version_file) # \xC2\xA9 is the copyright mark in UTF-8 copyright_message = '\xC2\xA9 %d Google Inc.' % _COPYRIGHT_YEAR long_version = version.GetVersionString() short_version = version.GetVersionInFormat('@MAJOR@.@MINOR@.@BUILD@') variables = { 'MOZC_VERSIONINFO_MAJOR': version.GetVersionInFormat('@MAJOR@'), 'MOZC_VERSIONINFO_MINOR': version.GetVersionInFormat('@MINOR@'), 'MOZC_VERSIONINFO_LONG': long_version, 'MOZC_VERSIONINFO_SHORT': short_version, 'MOZC_VERSIONINFO_FINDER': 'Google Japanese Input %s, %s' % (long_version, copyright_message), 'GEN_OUT_DIR': path.abspath(options.gen_out_dir), 'BUILD_DIR': path.abspath(options.build_dir), 'AUTO_UPDATER_DIR': path.abspath(options.auto_updater_dir), 'MOZC_DIR': path.abspath(path.join(os.getcwd(), "..")) } open(options.output, 'w').write( _RemoveDevOnlyLines( _ReplaceVariables(open(options.input).read(), variables), options.build_type))
def main(): """The main function.""" options = ParseOptions() required_flags = ['version_file', 'output', 'input'] for flag in required_flags: if getattr(options, flag) is None: logging.error('--%s is not specified.', flag) exit(-1) version = mozc_version.MozcVersion(options.version_file) if options.build_type == 'dev': omaha_tag = 'external-dev' else: omaha_tag = 'external-stable' # This definition is copied from tools/scons/script.py variables = [ ('@@@MOZC_VERSION@@@', version.GetVersionString()), ('@@@MOZC_PRODUCT_ID@@@', 'com.google.JapaneseIME'), ('@@@MOZC_APP_PATH@@@', '/Library/Input Methods/GoogleJapaneseInput.app'), ('@@@MOZC_APPLICATIONS_DIR@@@', '/Applications/GoogleJapaneseInput.localized'), ('@@@MOZC_OMAHA_TAG@@@', omaha_tag), ('@@@MOZC_PACKAGE_NAME@@@', 'GoogleJapaneseInput.pkg'), ] open(options.output, 'w').write( _ReplaceVariables(open(options.input).read(), variables))
def main(): """The main function.""" options = ParseOptions() if options.version_file is None: logging.error('--version_file is not specified.') sys.exit(-1) if options.output is None: logging.error('--output is not specified.') sys.exit(-1) if options.main is None: logging.error('--input is not specified.') sys.exit(-1) build_details = GenerateBuildProfile() if build_details: build_details = (' (%s)' % build_details) version = mozc_version.MozcVersion(options.version_file) bootstrapper_template = ( '#define MOZC_RES_VERSION_NUMBER @MAJOR@,@MINOR@,@BUILD@,@REVISION@\n' '#define MOZC_RES_VERSION_STRING "@MAJOR@.@MINOR@.@BUILD@.@REVISION@"\n' '#define MOZC_RES_SPECIFIC_VERSION_STRING ' '"@MAJOR@.@MINOR@.@BUILD@.@REVISION@%s"\n' '#include "%s"\n') % (build_details, options.main) version_definition = version.GetVersionInFormat(bootstrapper_template) old_content = '' if os.path.exists(options.output): # if the target file already exists, need to check the necessity of update. old_content = open(options.output).read() if version_definition != old_content: open(options.output, 'w').write(version_definition)
def main(): """The main function.""" options = ParseOptions() required_flags = ["version_file", "output", "input"] for flag in required_flags: if getattr(options, flag) is None: logging.error("--%s is not specified." % flag) exit(-1) version = mozc_version.MozcVersion(options.version_file, expand_daily=False) if options.build_type == "dev": omaha_tag = "external-dev" else: omaha_tag = "external-stable" # This definition is copied from tools/scons/script.py variables = [ ("@@@MOZC_VERSION@@@", version.GetVersionString()), ("@@@MOZC_PRODUCT_ID@@@", "com.google.JapaneseIME"), ("@@@MOZC_APP_PATH@@@", "/Library/Input Methods/GoogleJapaneseInput.app"), ("@@@MOZC_APPLICATIONS_DIR@@@", "/Application/GoogleJapaneseInput.localized"), ("@@@MOZC_OMAHA_TAG@@@", omaha_tag), ("@@@MOZC_PACKAGE_NAME@@@", "GoogleJapaneseInput.mpkg"), ] open(options.output, 'w').write(_ReplaceVariables(open(options.input).read(), variables))
def main(): """The main function.""" options = ParseOptions() if options.version_file is None: logging.error("--version_file is not specified.") sys.exit(-1) if options.output is None: logging.error("--output is not specified.") sys.exit(-1) if options.input is None: logging.error("--input is not specified.") sys.exit(-1) if options.branding is None: logging.error("--branding is not specified.") sys.exit(-1) version = mozc_version.MozcVersion(options.version_file) copyright_message = (u'© %d Google Inc.' % _COPYRIGHT_YEAR).encode('utf-8') long_version = version.GetVersionString() short_version = version.GetVersionInFormat('@MAJOR@.@MINOR@.@BUILD@') if options.branding == 'GoogleJapaneseInput': domain_prefix = 'com.google' product_name = 'Google Japanese Input' breakpad_product = 'Google_Japanese_IME_Mac' breakpad_url = 'https://clients2.google.com/cr/report' else: domain_prefix = 'org.mozc' product_name = 'Mozc' breakpad_product = 'Mozc' # Reports are generated under $TMPDIR, but not sent to a server. breakpad_url = 'file:///dev/null' variables = { 'GOOGLE_VERSIONINFO_LONG': long_version, 'GOOGLE_VERSIONINFO_SHORT': short_version, 'GOOGLE_VERSIONINFO_ABOUT': copyright_message, 'GOOGLE_VERSIONINFO_FINDER': '%s %s, %s' % (product_name, long_version, copyright_message), 'BRANDING': options.branding, 'DOMAIN_PREFIX': domain_prefix, 'BREAKPAD_PRODUCT': breakpad_product, 'BREAKPAD_URL': breakpad_url, } open(options.output, 'w').write( tweak_data.ReplaceVariables(open(options.input).read(), variables))
def main(): """The main function.""" options = ParseOptions() required_flags = [ "version_file", "output", "input", "build_dir", "gen_out_dir", "keystone_dir", "build_type" ] for flag in required_flags: if getattr(options, flag) is None: logging.error("--%s is not specified." % flag) exit(-1) keystone_data = _ExtractKeyStoneVersionData(options.keystone_dir) if keystone_data is None: logging.error("Cannot find Keystone.pkg. Wrong --keystone_dir flag?") exit(-1) version = mozc_version.MozcVersion(options.version_file, expand_daily=False) # \xC2\xA9 is the copyright mark in UTF-8 copyright_message = '\xC2\xA9 %d Google Inc.' % _COPYRIGHT_YEAR long_version = version.GetVersionString() short_version = version.GetVersionInFormat('@MAJOR@.@MINOR@.@BUILD@') variables = { 'MOZC_VERSIONINFO_MAJOR': version.GetVersionInFormat('@MAJOR@'), 'MOZC_VERSIONINFO_MINOR': version.GetVersionInFormat('@MINOR@'), 'MOZC_VERSIONINFO_LONG': long_version, 'MOZC_VERSIONINFO_SHORT': short_version, 'MOZC_VERSIONINFO_FINDER': 'Google Japanese Input %s, %s' % (long_version, copyright_message), 'GEN_OUT_DIR': path.abspath(options.gen_out_dir), 'BUILD_DIR': path.abspath(options.build_dir), 'KEYSTONE_DIR': path.abspath(options.keystone_dir), 'MOZC_DIR': path.abspath(path.join(os.getcwd(), "..")) } for keystone_var in keystone_data: variables[keystone_var] = keystone_data[keystone_var] open(options.output, 'w').write( _RemoveDevOnlyLines( _ReplaceVariables(open(options.input).read(), variables), options.build_type))
def main(): """The main function.""" options = ParseOptions() if options.version_file is None: logging.error("--version_file is not specified.") sys.exit(-1) if options.output is None: logging.error("--output is not specified.") sys.exit(-1) if options.input is None: logging.error("--input is not specified.") sys.exit(-1) if options.branding is None: logging.error("--branding is not specified.") sys.exit(-1) version = mozc_version.MozcVersion(options.version_file, expand_daily=False) # \xC2\xA9 is the copyright mark in UTF-8 copyright_message = '\xC2\xA9 %d Google Inc.' % _COPYRIGHT_YEAR long_version = version.GetVersionString() short_version = version.GetVersionInFormat('@MAJOR@.@MINOR@.@BUILD@') domain_prefix = 'org.mozc' product_name = 'Mozc' if options.branding == 'GoogleJapaneseInput': domain_prefix = 'com.google' product_name = 'Google Japanese Input' variables = { 'GOOGLE_VERSIONINFO_LONG': long_version, 'GOOGLE_VERSIONINFO_SHORT': short_version, 'GOOGLE_VERSIONINFO_ABOUT': copyright_message, 'GOOGLE_VERSIONINFO_FINDER': '%s %s, %s' % (product_name, long_version, copyright_message), 'BRANDING': options.branding, 'DOMAIN_PREFIX': domain_prefix, } open(options.output, 'w').write( tweak_data.ReplaceVariables(open(options.input).read(), variables))
def main(): """The main function.""" options = ParseOptions() if options.version_file is None: logging.error("--version_file is not specified.") exit(-1) if options.output is None: logging.error("--output is not specified.") exit(-1) if options.input is None: logging.error("--input is not specified.") exit(-1) version = mozc_version.MozcVersion(options.version_file, expand_daily=False, target_platform=options.target_platform) open(options.output, 'w').write(version.GetVersionInFormat(open(options.input).read()))