def main(): sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption(sourceRoot = sourceRoot, description = "Generates a header file from command-line defines.") # for compatibility with operasetup.py, store the defines in a dictionary def store_define(option, option_str, value, option_parser): if "=" in value: key, val = value.split("=", 1) else: key, val = value, None option_parser.values.ensure_value(option.dest, dict()).update({key:val}) option_parser.add_option("-D", metavar = "DEFINE[=VALUE]", dest = "defines", type = "string", action = "callback", callback = store_define, default = {}, help = "Add the specified define with the specified value.") (options, args) = option_parser.parse_args(sys.argv) stash_defines = StashDefines(options.defines) result = stash_defines(sourceRoot, options.outputRoot, options.quiet) if options.timestampfile and result != 1: util.fileTracker.finalize(options.timestampfile) if options.make and result == 2: result = 0 return result
changed = parser.writeOutputFiles(sourceRoot, outputRoot) if changed: result = 2 else: result = 0 else: result = 1 # error return self.endTiming(result, quiet=quiet) if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Generates from {adjunct,modules,platforms}/*/module.actions,", "actions_template.h, actions_enum_template.h,", "actions_strings_template.h and actions_template_template.h in", "modules/hardcore/actions the files generated_actions.h,", "generated_actions_enum.h, generated_actions_strings.h and ", "generated_actions_template.h in modules/hardcore/actions/.", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exitstatus is 1 if an error was detected." ])) (options, args) = option_parser.parse_args(args=sys.argv[1:]) generate_actions = GenerateActions() result = generate_actions(sourceRoot=sourceRoot, outputRoot=options.outputRoot, quiet=options.quiet) if options.timestampfile and result != 1: util.fileTracker.finalize(options.timestampfile) if options.make and result == 2: sys.exit(0) else: sys.exit(result)
os.path.join(libcryptoTestDir, "gadget_signing_ocsp.ot.template"), os.path.join(libcryptoTestDir, "gadget_signing_ocsp.ot"), HandleTemplateAction(filelist)) if changed: result = 2 else: result = 0 return self.endTiming(result, quiet=quiet) # ----- end functions ----- # main execution if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Generates gadget_signing_ocsp.ot from the wgt files in" "modules/libcrypto/selftest/data/widget-digsig-ocsp/ and the" "template gadget_signing_ocsp.ot.", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exitstatus is 1 if an error was detected." ])) (options, args) = option_parser.parse_args(args=sys.argv[1:]) generate = GenerateGadgetSigningOcsp_ot() result = generate(sourceRoot=sourceRoot, quiet=options.quiet) if options.make and result == 2: sys.exit(0) else: sys.exit(result)
else: defines_xml = 'defines.%s.xml' % feature_def.coreVersion() changes = util.readTemplate( os.path.join(hardcoreDir, 'base', 'defines_template.xml'), os.path.join(hardcoreDir, 'documentation', defines_xml), GenerateDefinesXml.DefinesTemplateAction(feature_def), hardcoreDir, 'documentation/%s' % defines_xml) if changes: return 2 else: return 0 if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, withMainlineConfiguration=True, description=" ".join([ "Reads and prints the core-version of the specified mainline", "configuration from the file modules/hardcore/version.ini." ])) option_parser.add_option( "--generate_doc_versionjs", action="store_true", dest="generate_doc_versionjs", help=" ".join([ "Generate the file modules/hardcore/documentation/version.js", "from modules/hardcore/version.ini and the template file", "modules/hardcore/documentation/version_template.js. Thus the", "documentation files (like features.html) can always produce", "links to the corresponding generated files (like", "features.{version}.xml)."
self.startTiming() parser = MarkupNameParser(sourceRoot, outputRoot, self.bigendian, debug, quiet) result = parser.processMarkupFiles(sourceRoot) return self.endTiming(result, quiet=quiet) if is_standalone: sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Generates elementtypes.h, elementnames.h, attrtypes.h,", "attrnames.h in modules/logdoc/src/html5 from ", "{adjunct,modules,platforms}/*/module.markup and ", "templates in modules/logdoc/scripts/. ", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exitstatus is 1 if an error was detected." ])) option_parser.add_option("-d", "--debug", dest="debug_mode", action="store_true") option_parser.add_option( "-b", "--big-endian", action="store_true", dest="bigendian",
finally: if f: f.close() if changed: result = 2 else: result = 0 return self.endTiming(result, quiet=quiet) if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "This script can be used as a standalone script or from operasetup.py to", "generate css_aliases.h, css_properties.h and css_property_strings.h based on", "their respective templates, drawing information from css_properties.txt.", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exit status is 1 if an error was detected." ])) (options, args) = option_parser.parse_args(args=sys.argv[1:]) generate_properties = GenerateProperties() result = generate_properties(sourceRoot=sourceRoot, outputRoot=options.outputRoot, quiet=options.quiet) if options.timestampfile and result != 1: util.fileTracker.finalize(options.timestampfile) if options.make and result == 2: sys.exit(0) else: sys.exit(result)
if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Generates the files modules/hardcore/opera/opera.h,", "modules/hardcore/opera/hardcore_opera.inc and", "modules/hardcore/base/capabilities.h from the files", "modules/hardcore/opera/module.txt,", "modules/hardcore/opera/blacklist.txt,", "{adjunct,modules,platforms}/readme.txt,", "{adjunct,modules,platforms}/*/*_capabilit*.h,", "{adjunct,modules,platforms}/*/*_module.h and the templates", "modules/hardcore/opera/opera_template.{h,inc},", "modules/hardcore/base/capabilities_template.cpp.", "Generate the files module/hardcore/opera/components.{h,inc} and", "module/hardcore/component/OpComponentCreate.inc from", "{adjunct,modules,platforms}/*/module.components and the", "templates module/hardcore/opera/components_template.h", "and module/hardcore/component/OpComponentCreate_template.inc.", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exitstatus is 1 if an error was detected." ])) option_parser.add_option( "--generate", action="append",
if i == 0: output.write("\t0x%08x /* bits %d - %d */\n" % (bits, base, base + 31)) else: output.write("\t, 0x%08x /* bits %d - %d */\n" % (bits, base, base + 31)) return True return False if is_standalone: sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot = sourceRoot, description=" ".join( ["Generates modules/svg/presentation_attrs.h from ", "modules/svg/scripts/presentation_attributes.txt and ", "the template modules/svg/scripts/pres_attrs_template.h.", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exitstatus is 1 if an error was detected."])) option_parser.add_option("-d", "--debug", dest="debug_mode", action="store_true") option_parser.set_defaults(debug_mode=False) (options, args) = option_parser.parse_args(args=sys.argv[1:]) generator = SVGPresentationAttrGenerator() result = generator(sourceRoot=sourceRoot, outputRoot=options.outputRoot, quiet=options.quiet, debug=options.debug_mode) if options.make and result == 2: sys.exit(0) else: sys.exit(result)
quiet, "working dir is %s; calling script %s" % (parser_dir, parser_path)) result = subprocess.call( [self.__pike, parser_path] + (['--outroot', outputRoot] if outputRoot else []), cwd=parser_dir, stdout=sys.stdout, stderr=sys.stderr) return self.endTiming(result, quiet=quiet) if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Executes modules/selftest/parser/parse_tests.pike to generate", "all selftest source files from all .ot files." ])) option_parser.add_option( "--pike", metavar="PATH_TO_EXECUTABLE", help=" ".join([ "Specifies the full path to the Pike executable to use on", "running parse_tests.pike. If the option is not specified, pike", "is expected to be found in one of the directories specified in", "the PATH environment variable." ])) (options, args) = option_parser.parse_args(args=sys.argv[1:]) selftests = GenerateSelftests(options.pike) result = selftests(sourceRoot,
# for operasetup to avoid full recompiles every time the protobuf # system is changed. # Any changes in those generated files are instead picked up # by the regular dependency system. if result == 2: result = 0 return result if __name__ == "__main__": sys.path.insert(1, os.path.join(sys.path[0], "..", "..", "protobuf")) sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Executes operatorsetup() in modules/protobuf/cppgen/script.py to generate", "cpp files from protocol buffer definition files (.proto)." ])) option_parser.add_option( "--show-all", dest="show_all", action="store_true", default=False, help= "Show all files which are processed, not just the ones which are modified" ) option_parser.add_option( "--show-modified", dest="show_all", action="store_false",
import os.path import re import sys # import from modules/hardcore/scripts sys.path.insert(1, os.path.join(sys.path[0], "..", "scripts")) import opera_module import basesetup sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Generate the files core/pch.h, core/pch_system_includes.h and", "core/pch_jumbo.h in modules/hardcore/setup/plain/include/ and", "modules/hardcore/setup/jumbo/include/ from", "modules/hardcore/base/pch_template.h.", "The script exits with status 0 if none of the output files was", "changed. The exit status is 2 if at least one of the output files", "was changed (see also option '--make'). The exit status is 1 if", "an error was detected." ])) option_parser.add_option( "--platform_product_config", metavar="FILENAME", help=" ".join([ "The filename should be a platform specific header file, relative to", "the source-root, which defines the macros PRODUCT_FEATURE_FILE,", "PRODUCT_SYSTEM_FILE, PRODUCT_OPKEY_FILE, PRODUCT_ACTIONS_FILE and", "PRODUCT_TWEAKS_FILE.", "The generated files modules/hardcore/setup/*/include/core/pch*.h",
else None, 'domevent_keys.cpp') or changed if changed: result = 2 # files have changed else: result = 0 # no changes else: result = 1 # error return self.endTiming(result, quiet=quiet) if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Generate the files opkeys_mappings.inc and opkeys.h in", "modules/hardcore/keys/ from", "{adjunct,modules,platforms}/readme.txt and", "{adjunct,modules,platforms}/*/module.keys.", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exitstatus is 1 if an error was detected." ])) (options, args) = option_parser.parse_args(args=sys.argv[1:]) generate_actions = GenerateOpKeys() result = generate_actions(sourceRoot, outputRoot=options.outputRoot, quiet=options.quiet) if options.timestampfile and result != 1: util.fileTracker.finalize(options.timestampfile) if options.make and result == 2: sys.exit(0) else: sys.exit(result)
result = 2 # output file was changed self.endTiming(result, quiet=quiet) # don't let operasetup regenerate operasetup.h if this file was changed: if result == 2: return 0 else: return result if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Generate a header file that defines the VER_BUILD_IDENTIFIER", "macro as the string that contains the result of 'git describe", "--dirty'. That generated header file can be used as a value for", "the TWEAK_ABOUT_BUILD_NUMBER_HEADER. See also option --output.", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exitstatus is 1 if an error was detected." ])) option_parser.add_option( "--git", metavar="PATH_TO_EXECUTABLE", help=" ".join([ "Specifies the full path to the git executable to use on running", "'git describe --dirty'. If the option is not specified, git is", "expected to be found in one of the directories specified in the", "PATH environment variable." ]))
outputRoot=outputRoot, quiet=quiet) if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, withMainlineConfiguration=True, description=" ".join([ "Generate the files", "{outroot}/modules/hardcore/features/features.h,", "{outroot}/modules/hardcore/features/profile_{PROFILES}.h,", "modules/hardcore/opera/setupinfo_features.cpp and", "modules/hardcore/documentation/features.{core_version}.xml", "from modules/hardcore/features/features.{core_version}.txt,", "and the template files", "modules/hardcore/features/features_template.h,", "modules/hardcore/features/profile_template.h,", "modules/hardcore/opera/setupinfo_features_template.cpp and", "modules/hardcore/features/features_template.xml.", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exitstatus is 1 if an error was detected." ])) (options, args) = option_parser.parse_args(args=sys.argv[1:]) try: feature_def = util.getFeatureDef(sourceRoot, options.mainline_configuration) generate_features = GenerateFeaturesH()
allfiles, cwd=sourceRoot) if outputRoot == sourceRoot: util.updateModuleGenerated(documentation_output_dir, ["documentation/settings.html"]) if changed: result = 2 else: result = 0 return self.endTiming(result, quiet=quiet) if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Generates source files from preferences definition files (.txt)." ]), withPerl=True) option_parser.add_option( "--show-all", dest="show_all", action="store_true", default=False, help= "Show all files which are processed, not just the ones which are modified" ) option_parser.add_option( "--show-modified", dest="show_all", action="store_false",
changed = messages_parser.writeOutputFiles(sourceRoot, outputRoot) if changed: result = 2 # files have changed else: result = 0 # no changes else: result = 1 # error return self.endTiming(result, quiet=quiet) if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, withMainlineConfiguration=True, description=" ".join( ["Generate the files", "{outroot}/modules/hardcore/mh/generated_messages.h,", "{outroot}/modules/hardcore/mh/generated_message_strings.inc", "from {adjunct,modules,platforms}/readme.txt,", "{adjunct,modules,platforms}/*/module.messages{version} and", "the template files modules/hardcore/mh/messages_template.h,", "and modules/hardcore/mh/message_strings_template.inc.", "The script exists with status 0 if none of the output files", "was changed. The exist status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exitstatus is 1 if an error was detected."])) (options, args) = option_parser.parse_args(args=sys.argv[1:]) try: feature_def = util.getFeatureDef(sourceRoot, options.mainline_configuration) generate_messages = GenerateMessages() result = generate_messages(sourceRoot=sourceRoot, feature_def=feature_def, outputRoot=options.outputRoot, quiet=options.quiet)
result = 2 # List the generated files in module.generated if outputRoot == sourceRoot: util.updateModuleGenerated(modulepath, [enumfile[len(modulepath) + 1:], datafile[len(modulepath) + 1:]]) return self.endTiming(result, quiet=quiet) if __name__ == "__main__": sys.path.insert(1, os.path.join(sys.path[0], "..", "..", "viewers", "src")) sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join( ["Executes BuildViewers() in modules/viewers/src/viewers.py to generate", "source files from viewer definitions (module.viewers)."])) option_parser.add_option( "--show-all", dest="show_all", action="store_true", default=False, help="Show all files which are processed, not just the ones which are modified") option_parser.add_option( "--show-modified", dest="show_all", action="store_false", help="Show only modified files which are processed") (options, args) = option_parser.parse_args(args=sys.argv[1:]) myviewers = GenerateViewers() result = myviewers(sourceRoot, quiet=options.quiet, show_all=options.show_all) if options.timestampfile and result != 1: util.fileTracker.finalize(options.timestampfile)
verify_sources=self.__verify_sources): result = 2 # changed else: result = 0 # no changes return self.endTiming(result, quiet=quiet) if __name__ == "__main__": sourceRoot = os.path.normpath(os.path.join(sys.path[0], "..", "..", "..")) option_parser = basesetup.OperaSetupOption( sourceRoot=sourceRoot, description=" ".join([ "Generate the files sources.all, sources.nopch, sources.pch,", "sources.pch_system_includes, sources.pch_jumbo and", "sources.component_* in both", "modules/hardcore/setup/plain/sources and", "modules/hardcore/setup/jumbo/sources.", "In addition generate the jumbo compile units of all modules.", "The script exits with status 0 if none of the output files", "was changed. The exit status is 2 if at least one of the", "output files was changed (see also option '--make').", "The exit status is 1 if an error was detected." ])) option_parser.add_option( "--ignore-missing-sources", action="store_false", dest="verify_sources", help=" ".join([ "Ignore missing source files. The default is to print an", "error message when a source file is not found and exit with", "status 1."