def main(_): """Launch the appropriate builder.""" config_lib.CONFIG.AddContext( "ClientBuilder Context", "Context applied when we run the client builder script.") startup.ClientInit() # Use basic console output logging so we can see what is happening. logger = logging.getLogger() handler = logging.StreamHandler() handler.setLevel(logging.INFO) logger.handlers = [handler] context = flags.FLAGS.context context = SetContextFromArgs(context) signer = None if args.sign: if not args.templatedir: raise RuntimeError( "Signing must be performed on the host system since " "that's where the keys are. If you want signed " "binaries you need to build templates in the vagrant " "vms then pass the templatedir here to do the repack " "and sign operation on the host.") signer = GetSigner(context) if args.subparser_name == "build": template_path = None if flags.FLAGS.output: template_path = os.path.join( flags.FLAGS.output, config_lib.CONFIG.Get("PyInstaller.template_filename", context=context)) builder_obj = GetBuilder(context) builder_obj.MakeExecutableTemplate(output_file=template_path) elif args.subparser_name == "repack": Repack(context, signer=signer) elif args.subparser_name == "deploy": Deploy(context, signer=signer) elif args.subparser_name == "buildanddeploy": if args.platform == "windows": # Handle windows differently because we do 32, 64, and debug builds all at # once. BuildAndDeployWindows(signer=signer) else: BuildAndDeploy(context, signer=signer) elif args.subparser_name == "build_components": component.BuildComponents(output_dir=flags.FLAGS.output) elif args.subparser_name == "build_component": component.BuildComponent(flags.FLAGS.setup_file, output_dir=flags.FLAGS.output)
def main(_): """Launch the appropriate builder.""" if flags.FLAGS.subparser_name == "generate_client_config": # We don't need a full init to just build a config. GetClientConfig(flags.FLAGS.client_config_output) return # We deliberately use flags.FLAGS.context because client_startup.py pollutes # config_lib.CONFIG.context with the running system context. context = flags.FLAGS.context context.append("ClientBuilder Context") client_startup.ClientInit() # Use basic console output logging so we can see what is happening. logger = logging.getLogger() handler = logging.StreamHandler() handler.setLevel(logging.INFO) logger.handlers = [handler] if args.subparser_name == "build": TemplateBuilder().BuildTemplate(context=context, output=flags.FLAGS.output) elif args.subparser_name == "repack": if args.debug_build: context.append("DebugClientBuild Context") result_path = repacking.TemplateRepacker().RepackTemplate( args.template, args.output_dir, context=context, sign=args.sign, signed_template=args.signed_template) if not result_path: raise ErrorDuringRepacking(" ".join(sys.argv[:])) elif args.subparser_name == "repack_multiple": MultiTemplateRepacker().RepackTemplates( args.repack_configs, args.templates, args.output_dir, config=args.config, sign=args.sign, signed_template=args.signed_template) elif args.subparser_name == "build_components": component.BuildComponents(output_dir=flags.FLAGS.output) elif args.subparser_name == "build_component": component.BuildComponent(flags.FLAGS.setup_file, output_dir=flags.FLAGS.output) elif args.subparser_name == "sign_template": repacking.TemplateRepacker().SignTemplate(args.template, args.output_file, context=context) if not os.path.exists(args.output_file): raise RuntimeError("Signing failed: output not written")
def main(_): """Launch the appropriate builder.""" config_lib.CONFIG.AddContext( "ClientBuilder Context", "Context applied when we run the client builder script.") startup.ClientInit() # Make sure we have all the secondary configs since they may be set under the # ClientBuilder Context for secondconfig in config_lib.CONFIG["ConfigIncludes"]: config_lib.CONFIG.LoadSecondaryConfig(secondconfig) # Use basic console output logging so we can see what is happening. logger = logging.getLogger() handler = logging.StreamHandler() handler.setLevel(logging.INFO) logger.handlers = [handler] context = flags.FLAGS.context context = SetContextFromArgs(context) signer = None if args.sign: signer = GetSigner(context) if args.subparser_name == "build": builder_obj = GetBuilder(context) builder_obj.MakeExecutableTemplate() elif args.subparser_name == "repack": Repack(context, signer=signer) elif args.subparser_name == "deploy": Deploy(context, signer=signer) elif args.subparser_name == "buildanddeploy": if args.platform == "windows": # Handle windows differently because we do 32, 64, and debug builds all at # once. BuildAndDeployWindows(signer=signer) else: BuildAndDeploy(context, signer=signer) elif args.subparser_name == "build_component": setup_file = flags.FLAGS.setup_file client_component = component.BuildComponent(setup_file) output = os.path.join(flags.FLAGS.output, "%s_%s_%s.bin" % ( client_component.summary.name, client_component.summary.version, client_component.summary.build_system.signature())) with open(output, "wb") as fd: fd.write(client_component.SerializeToString()) print "Built component %s" % output
def main(_): """Launch the appropriate builder.""" config_lib.CONFIG.AddContext( "ClientBuilder Context", "Context applied when we run the client builder script.") startup.ClientInit() # Make sure we have all the secondary configs since they may be set under the # ClientBuilder Context for secondconfig in config_lib.CONFIG["ConfigIncludes"]: config_lib.CONFIG.LoadSecondaryConfig(secondconfig) # Use basic console output logging so we can see what is happening. logger = logging.getLogger() handler = logging.StreamHandler() handler.setLevel(logging.INFO) logger.handlers = [handler] context = flags.FLAGS.context context = SetContextFromArgs(context) signer = None if args.sign: signer = GetSigner(context) if args.subparser_name == "build": builder_obj = GetBuilder(context) builder_obj.MakeExecutableTemplate() elif args.subparser_name == "repack": Repack(context, signer=signer) elif args.subparser_name == "deploy": Deploy(context, signer=signer) elif args.subparser_name == "buildanddeploy": if args.platform == "windows": # Handle windows differently because we do 32, 64, and debug builds all at # once. BuildAndDeployWindows(signer=signer) else: BuildAndDeploy(context, signer=signer) elif args.subparser_name == "build_components": component.BuildComponents(output_dir=flags.FLAGS.output) elif args.subparser_name == "build_component": component.BuildComponent(flags.FLAGS.setup_file, output_dir=flags.FLAGS.output)