parameters: ()
docstring: The main function.
docstring_summary: The main function.
docstring_tokens: The main function .
function: 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)
function_tokens: def main ( ) : 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 )