def main(): parser = optparse.OptionParser() parser.set_usage('''\ %prog --name APPLICATIONNAME [--out DIRECTORY] [--namespace NAMESPACE] [-logfile LOGFILE] [--skeleton-path PATH] Script to create a new qooxdoo application. Example: For creating a regular GUI application \'myapp\' you could execute: %prog --name myapp''') parser.add_option( "-n", "--name", dest="name", metavar="APPLICATIONNAME", help="Name of the application. An application folder with identical name will be created. (Required)" ) parser.add_option( "-o", "--out", dest="out", metavar="DIRECTORY", default=".", help="Output directory for the application folder. (Default: %default)" ) parser.add_option( "-s", "--namespace", dest="namespace", metavar="NAMESPACE", default=None, help="Applications's top-level namespace. (Default: APPLICATIONNAME)" ) parser.add_option( "-l", "--logfile", dest="logfile", metavar="LOGFILE", default=None, type="string", help="Log file" ) parser.add_option( "-p", "--skeleton-path", dest="skeleton_path", metavar="PATH", default=SKELETON_DIR, help="(Advanced) Path where the script looks for skeletons. " + "The directory must contain sub directories named by " + "the application types. (Default: %default)" ) (options, args) = parser.parse_args(sys.argv[1:]) if not options.name: parser.print_help() sys.exit(1) else: options.name = options.name.decode('utf-8') # Initialize console global console console = Log(options.logfile, "info") checkNamespace(options) getQxVersion() outDir = createApplication(options) runNpmIf(outDir, options) console.log("DONE") return
def main(): # Initialize console global console console = Log('toolbox.log', "info") form = process_parms() emit_http_headers() fix_env(form) dispatch_action(form)
def read_config(options): Context.console = Log( ) # some module down the way looks for Context.console... config = Config(Context.console, options.config) config.resolveIncludes() default_job = config.get("default-job", "default") expandedjobs = config.resolveExtendsAndRuns([default_job]) config.includeSystemDefaults(expandedjobs) config.resolveLibs(expandedjobs) config.checkSchema(expandedjobs, checkJobTypes=True) config.cleanUpJobs(expandedjobs) options.config = config return
def __init__(self, path, **kwargs): self._cache_revision = CACHE_REVISION self._path = path self._context = kwargs self._console = kwargs.get('console', Log()) self._downloads = kwargs.get("cache/downloads", path + "/downloads") self._check_file = os.path.join(self._path, check_file) self._console.debug("Initializing cache...") self._console.indent() self._check_path(self._path) self._locked_files = set(()) self._context['interruptRegistry'].register(self._unlock_files) self._assureCacheIsValid() # checks and pot. clears existing cache self._console.outdent() return
def do_lint(file_, popup): if popup: logger = util.PopupLogger() else: logger = util.TextMateLogger() logger.printHeader("qooxdoo JavaScript lint", "qooxdoo JavaScript lint") try: opts = lint.defaultOptions() opts.allowed_globals = ['qx', 'qxWeb', 'q'] tree_ = treegenerator.createFileTree_from_string( codecs.open(file_, "r", "utf-8").read()) tree_ = scopes.create_scopes(tree_) if not getattr(context, 'console', None): context.console = Log() if not getattr(context, 'jobconf', None): context.jobconf = ExtMap() context.jobconf.set("lint-check/warn-unknown-jsdoc-keys", True) lint.lint_check(tree_, "", opts) except treegenerator.SyntaxException, e: logger.log(file_, 0, 0, str(e))
def main(): global options (options, args) = GeneratorArguments(option_class=ExtendAction).parse_args( sys.argv[1:]) if args: options.jobs = args[0].split(',') else: options.jobs = [] # Initialize console if options.verbose: level = "debug" elif options.quiet: level = "warning" else: level = "info" console = Log(options.logfile, level) Context.console = console # Treat verbosity of pre-job processing if options.config_verbose: console.setLevel("debug") console.setFilter(["generator.config.*"]) else: console.setLevel("info") # Initial user feedback appname = ((os.path.dirname(os.path.abspath(options.config)).split( os.sep)))[-1] console.head(u"Initializing: %s" % appname.decode('utf-8'), True) console.info(u"Processing configuration") console.debug(u" file: %s" % options.config) # Load application configuration config = Config(console, options.config, **options.letmacros) # Load user configuration (preferences) config = getUserConfig(config) # Insert remaining command line args config = getAdditonalArgs(config, args[1:]) # Early check for log filter -- doesn't work as there is no job selected yet #console.setFilter(config.get("log/filter/debug", [])) # Resolve "include"-Keys console.debug("Resolving config includes...") console.indent() config.resolveIncludes() console.outdent() # Check jobs availableJobs = config.getExportedJobsList() if len(options.jobs) == 0: default_job = config.get("default-job", "") if default_job: options.jobs.append(default_job) else: if not options.daemon: listJobs(console, availableJobs, config) sys.exit(1) else: for job in options.jobs: if job not in availableJobs: console.warn("No such job: %s" % job) listJobs(console, availableJobs, config) sys.exit(1) console.debug(u"Jobs: %s" % ", ".join(options.jobs)) context = { 'config': config, 'console': console, 'jobconf': None, 'interruptRegistry': interruptRegistry } Context.config = config # TODO: clean up overlap between context dict and Context module # CLI mode if not options.daemon: # Resolve "extend"- and "run"-Keys expandedjobs = config.resolveExtendsAndRuns(options.jobs[:]) # Include system defaults config.includeSystemDefaults(expandedjobs) # Resolve "let"-Keys config.resolveMacros(expandedjobs) # Resolve libs/Manifests config.resolveLibs(expandedjobs) # To see fully expanded config: #console.info(pprint.pformat(config.get("."))) # Do some config schema checking config.checkSchema(expandedjobs, checkJobTypes=True) # Clean-up config config.cleanUpJobs(expandedjobs) # Reset console level console.setLevel(level) console.resetFilter() # Processing jobs... for job in expandedjobs: console.head("Executing: %s" % job.name, True) if options.config_verbose: console.setLevel("debug") console.debug("Expanded job config:") console.debug(pprint.pformat(config.getJob(job).getData())) console.setLevel(level) ctx = context.copy() ctx['jobconf'] = config.getJob(job) Context.jobconf = ctx['jobconf'] generatorObj = Generator(ctx) generatorObj.run() # Daemon mode else: from generator.runtime.Generatord import Generatord console.head("Executing: Daemon Mode", True) generatord = Generatord(context) console.info("Opening port %s on %s, serving in background..." % (generatord.servAddr[1], generatord.servAddr[0] if generatord.servAddr[0] else 'localhost')) generatord.serve()
def main(): parser = optparse.OptionParser() parser.set_usage('''\ %prog --name APPLICATIONNAME [--out DIRECTORY] [--namespace NAMESPACE] [--type TYPE] [-logfile LOGFILE] [--skeleton-path PATH] Script to create a new qooxdoo application. Example: For creating a regular GUI application \'myapp\' you could execute: %prog --name myapp''') parser.add_option( "-n", "--name", dest="name", metavar="APPLICATIONNAME", help="Name of the application. An application folder with identical name will be created. (Required)" ) parser.add_option( "-o", "--out", dest="out", metavar="DIRECTORY", default=".", help="Output directory for the application folder. (Default: %default)" ) parser.add_option( "-s", "--namespace", dest="namespace", metavar="NAMESPACE", default=None, help="Applications's top-level namespace. (Default: APPLICATIONNAME)" ) parser.add_option( "-t", "--type", dest="type", metavar="TYPE", default="gui", help="Type of the application to create, one of: "+str(APP_TYPES)+"." + "'gui' builds a standard qooxdoo GUI application, " + "'inline' builds a inline qooxdoo GUI application, " + "'migration' should " + "be used to migrate qooxdoo 0.7 applications and " + "'bom' can be used " + "to build low-level qooxdoo applications. (Default: %default)" ) parser.add_option( "-l", "--logfile", dest="logfile", metavar="LOGFILE", default=None, type="string", help="Log file" ) parser.add_option( "-p", "--skeleton-path", dest="skeleton_path", metavar="PATH", default=SKELETON_DIR, help="(Advanced) Path where the script looks for skeletons. " + "The directory must contain sub directories named by " + "the application types. (Default: %default)" ) (options, args) = parser.parse_args(sys.argv[1:]) if not options.name: parser.print_help() sys.exit(1) if not options.namespace: options.namespace = options.name.lower().replace(" ", "_") # Initialize console global console console = Log(options.logfile, "info") createApplication( options.name, options.out, options.namespace, options.type, options.skeleton_path ) console.log("DONE")
def main(): parser = optparse.OptionParser(option_class=ExtendAction) usage_str = '''%prog [options] job,... Arguments: job,... a list of jobs (like 'source' or 'copy-files', without the quotes) to perform ? use '?' to get a list of all available jobs from the configuration file''' parser.set_usage(usage_str) # Common options parser.add_option( "-c", "--config", dest="config", metavar="CFGFILE", default="config.json", help= "path to configuration file containing job definitions (default: %default)" ) #parser.add_option("-j", "--jobs", action="extend", dest="jobs", type="string", default=[], help="List of jobs to run") parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, help="quiet output mode (extra quiet)") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose output mode (extra verbose)") parser.add_option("-l", "--logfile", dest="logfile", metavar="FILENAME", default=None, type="string", help="log file") # wpbasti: TODO: Add option to insert arbitrary number of macros values # Could also be an good replacement for the four in the following listed options # Dynamic options (currently not supported) #parser.add_option("--setting", action="extend", dest="settings", metavar="KEY:VALUE", type="string", default=[], help="Used settings") #parser.add_option("--variant", action="extend", dest="variants", metavar="KEY:VALUE", type="string", default=[], help="Selected variants") #parser.add_option("--require", action="extend", dest="require", metavar="CLASS1:CLASS2", type="string", default=[], help="Special loadtime class dependencies") #parser.add_option("--use", action="extend", dest="use", metavar="CLASS1:CLASS2", type="string", default=[], help="Special runtime class dependencies") (options, args) = parser.parse_args(sys.argv[1:]) if not args: parser.print_help() sys.exit(1) else: options.jobs = args[0].split(',') # Initialize console if options.verbose: level = "debug" elif options.quiet: level = "warning" else: level = "info" console = Log(options.logfile, level) # Initial user feedback appname = ((os.path.dirname(os.path.abspath(options.config)).split( os.sep)))[-1] console.head("Initializing: %s" % appname, True) console.info("Configuration: %s" % options.config) console.info("Jobs: %s" % ", ".join(options.jobs)) # Load configuration config = Config(console, options.config) # Resolve "include"-Keys config.resolveIncludes() # Check jobs availableJobs = config.getExportedJobsList() if len(options.jobs) == 0: listJobs(console, availableJobs) sys.exit(1) else: for job in options.jobs: if job not in availableJobs: console.warn("No such job: %s" % job) listJobs(console, availableJobs) sys.exit(1) # Resolve "extend"- and "run"-Keys expandedjobs = config.resolveExtendsAndRuns(options.jobs[:]) # Resolve "let"-Keys config.resolveMacros(expandedjobs) # Resolve libs/Manifests config.resolveLibs(expandedjobs) # To see fully expanded config: console.debug(pprint.pformat(config.get("."))) # Processing jobs... for job in expandedjobs: console.head("Executing: %s" % job, True) Generator(config, job, console).run()
def main(): global console # Init console object console = Log() if len(sys.argv[1:]) == 0: basename = os.path.basename(sys.argv[0]) console.info("Usage: %s [options]" % basename) console.info("Try '%s -h' or '%s --help' to show the help message." % (basename, basename)) sys.exit(1) parser = optparse.OptionParser() parser.add_option("--source", dest="source", metavar="DIRECTORY", help="Source directory of theme") parser.add_option("--target", dest="target", metavar="DIRECTORY", help="Target directory for theme") parser.add_option("--sync", dest="sync", action="store_true", default=False) (options, args) = parser.parse_args(sys.argv[1:]) if options.source == None or options.target == None: console.error("Please define both, the target and the source folder!") sys.exit(1) data = getData() source = os.path.abspath(options.source) target = os.path.abspath(options.target) sync = options.sync console.info("Processing theme...") console.info("Source folder: %s" % source) console.info("Target folder: %s" % target) console.indent() # Process entries for entry in data: name = entry[0] console.info("Processing entry %s" % name) console.indent() # Preparing name list name = entry[0] pre = name.split("/")[0] short = name.split("/")[1] names = [] names.extend(entry) # Copy images in different sizes for size in SIZES: copyFile(source, target, entry, size, sync) console.outdent() console.outdent()
def main(): parser = optparse.OptionParser() parser.set_usage('''\ %prog --name APPLICATIONNAME [--out DIRECTORY] [--namespace NAMESPACE] [--type TYPE] [-logfile LOGFILE] [--skeleton-path PATH] Script to create a new qooxdoo application. Example: For creating a regular GUI application \'myapp\' you could execute: %prog --name myapp''') parser.add_option( "-n", "--name", dest="name", metavar="APPLICATIONNAME", help="Name of the application. An application folder with identical name will be created. (Required)" ) parser.add_option( "-o", "--out", dest="out", metavar="DIRECTORY", default=".", help="Output directory for the application folder. (Default: %default)" ) parser.add_option( "-s", "--namespace", dest="namespace", metavar="NAMESPACE", default=None, help="Applications's top-level namespace. (Default: APPLICATIONNAME)" ) parser.add_option( "-t", "--type", dest="type", metavar="TYPE", default="gui", help="Type of the application to create, one of: "+str(map(str, sorted(APP_INFOS.keys())))+"." + str(", ".join(["'%s' %s" % (x, y) for x,y in sorted(APP_INFOS.items())])) + ". (Default: %default)" ) parser.add_option( "-l", "--logfile", dest="logfile", metavar="LOGFILE", default=None, type="string", help="Log file" ) parser.add_option( "-p", "--skeleton-path", dest="skeleton_path", metavar="PATH", default=SKELETON_DIR, help="(Advanced) Path where the script looks for skeletons. " + "The directory must contain sub directories named by " + "the application types. (Default: %default)" ) parser.add_option( "--cache", dest="cache", metavar="PATH", default="${TMPDIR}/qx${QOOXDOO_VERSION}/cache", help="Path to the cache directory; will be entered into config.json's CACHE macro (Default: %default)" ) (options, args) = parser.parse_args(sys.argv[1:]) if not options.name: parser.print_help() sys.exit(1) else: options.name = options.name.decode('utf-8') # Initialize console global console console = Log(options.logfile, "info") checkNamespace(options) getQxVersion() createApplication(options) console.log("DONE")
def main(): parser = optparse.OptionParser() parser.set_usage('''\ %prog --name APPLICATIONNAME [--out DIRECTORY] [--namespace NAMESPACE] [--type TYPE] [-logfile LOGFILE] [--skeleton-path PATH] Script to create a new qooxdoo application. Example: For creating a regular GUI application \'myapp\' you could execute: %prog --name myapp''') parser.add_option( "-n", "--name", dest="name", metavar="APPLICATIONNAME", help="Name of the application. An application folder with identical name will be created. (Required)" ) parser.add_option( "-o", "--out", dest="out", metavar="DIRECTORY", default=".", help="Output directory for the application folder. (Default: %default)" ) parser.add_option( "-s", "--namespace", dest="namespace", metavar="NAMESPACE", default=None, help="Applications's top-level namespace. (Default: APPLICATIONNAME)" ) parser.add_option( "-t", "--type", dest="type", metavar="TYPE", default="desktop", help=skeletonsHelpString() ) parser.add_option( "-l", "--logfile", dest="logfile", metavar="LOGFILE", default=None, type="string", help="Log file" ) parser.add_option( "-p", "--skeleton-path", dest="skeleton_path", metavar="PATH", default=SKELETON_DIR, help="(Advanced) Path where the script looks for skeletons. " + "The directory must contain sub directories named by " + "the application types. (Default: %default)" ) parser.add_option( "--cache", dest="cache", metavar="PATH", default="${TMPDIR}/qx${QOOXDOO_VERSION}/cache", help="Path to the cache directory; will be entered into config.json's CACHE macro (Default: %default)" ) (options, args) = parser.parse_args(sys.argv[1:]) if not options.name: parser.print_help() sys.exit(1) else: options.name = options.name.decode('utf-8') # Initialize console global console console = Log(options.logfile, "info") checkNamespace(options) getQxVersion() outDir = createApplication(options) npm_install(outDir, options) console.log("DONE")
def main(): parser = optparse.OptionParser(option_class=ExtendAction) usage_str = '''%prog [options] job,... Arguments: job,... a list of jobs (like 'source' or 'copy-files', without the quotes) to perform ? use '?' to get a list of all available jobs from the configuration file''' parser.set_usage(usage_str) # Common options parser.add_option("-c", "--config", dest="config", metavar="CFGFILE", default="config.json", help="path to configuration file containing job definitions (default: %default)") #parser.add_option("-j", "--jobs", action="extend", dest="jobs", type="string", default=[], help="List of jobs to run") parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, help="quiet output mode (extra quiet)") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose output mode (extra verbose)") parser.add_option("-l", "--logfile", dest="logfile", metavar="FILENAME", default=None, type="string", help="log file") # wpbasti: TODO: Add option to insert arbitrary number of macros values # Could also be an good replacement for the four in the following listed options # Dynamic options (currently not supported) #parser.add_option("--setting", action="extend", dest="settings", metavar="KEY:VALUE", type="string", default=[], help="Used settings") #parser.add_option("--variant", action="extend", dest="variants", metavar="KEY:VALUE", type="string", default=[], help="Selected variants") #parser.add_option("--require", action="extend", dest="require", metavar="CLASS1:CLASS2", type="string", default=[], help="Special loadtime class dependencies") #parser.add_option("--use", action="extend", dest="use", metavar="CLASS1:CLASS2", type="string", default=[], help="Special runtime class dependencies") (options, args) = parser.parse_args(sys.argv[1:]) if not args: parser.print_help() sys.exit(1) else: options.jobs = args[0].split(',') # Initialize console if options.verbose: level = "debug" elif options.quiet: level = "warning" else: level = "info" console = Log(options.logfile, level) # Initial user feedback appname = ((os.path.dirname(os.path.abspath(options.config)).split(os.sep)))[-1] console.head(u"Initializing: %s" % appname.decode('utf-8'), True) console.info(u"Configuration: %s" % options.config) console.info(u"Jobs: %s" % ", ".join(options.jobs)) # Load configuration config = Config(console, options.config) # Resolve "include"-Keys console.info("Resolving config includes...") console.indent() config.resolveIncludes() console.outdent() # Check jobs availableJobs = config.getExportedJobsList() if len(options.jobs) == 0: listJobs(console, availableJobs, config) sys.exit(1) else: for job in options.jobs: if job not in availableJobs: console.warn("No such job: %s" % job) listJobs(console, availableJobs, config) sys.exit(1) # Resolve "extend"- and "run"-Keys expandedjobs = config.resolveExtendsAndRuns(options.jobs[:]) # Include system defaults config.includeSystemDefaults(expandedjobs) # Resolve "let"-Keys config.resolveMacros(expandedjobs) # Resolve libs/Manifests config.resolveLibs(expandedjobs) # To see fully expanded config: #console.info(pprint.pformat(config.get("."))) # Processing jobs... context = {'config': config, 'console':console, 'jobconf':None, 'interruptRegistry':interruptRegistry} for job in expandedjobs: console.head("Executing: %s" % job.name, True) console.debug("Expanded job config:") console.debug(pprint.pformat(config.getJob(job).getData())) ctx = context.copy() ctx['jobconf'] = config.getJob(job) generatorObj = Generator(ctx) generatorObj.run()
def main(): global options (options, args) = GeneratorArguments(option_class=ExtendAction).parse_args( sys.argv[1:]) if args: options.jobs = args[0].split(',') else: options.jobs = [] # Save cli options to Context gen_opts = [x for x in sys.argv[1:] if x not in args] # cli options without jobs list Context.generator_opts = gen_opts # as list # Initialize console if options.verbose: level = "debug" elif options.quiet: level = "warning" else: level = "info" console = Log(options.logfile, level) Context.console = console # Grunt compat: Print list of jobs as json if options.listjobs: config = initConfig(console, options, args) config.resolveIncludes() from misc import json print( json.dumpsPretty(getJobsDesc(config.getExportedJobsList(), config))) sys.exit(0) # Treat verbosity of pre-job processing if options.config_verbose: console.setLevel("debug") console.setFilter(["generator.config.*"]) else: console.setLevel("info") # Show progress indicator? console.progress_indication = options.show_progress_indicator # Initial user feedback appname = ((os.path.dirname(os.path.abspath(options.config)).split( os.sep)))[-1] console.head(u"Initializing: %s" % appname.decode('utf-8'), True) console.info(u"Processing configuration") console.debug(u" file: %s" % options.config) config = initConfig(console, options, args) # Early check for log filter -- doesn't work as there is no job selected yet #console.setFilter(config.get("log/filter/debug", [])) # Resolve "include"-Keys console.debug("Resolving config includes...") console.indent() config.resolveIncludes() console.outdent() # Check jobs availableJobs = config.getExportedJobsList() if len(options.jobs) == 0: default_job = config.get("default-job", "") if default_job: options.jobs.append(default_job) else: listJobs(console, availableJobs, config) sys.exit(1) elif '_all_' in options.jobs: options.jobs = [] for job in availableJobs: if job not in _ALL_SKIP_JOBS: options.jobs.append(job) else: for job in options.jobs: if job not in availableJobs: console.warn("No such job: %s" % job) listJobs(console, availableJobs, config) sys.exit(1) console.debug(u"Jobs: %s" % ", ".join(options.jobs)) context = { 'config': config, 'console': console, 'jobconf': None, 'interruptRegistry': interruptRegistry } Context.config = config # TODO: clean up overlap between context dict and Context module # Resolve "extend"- and "run"-Keys expandedjobs = config.resolveExtendsAndRuns(options.jobs[:]) # Include system defaults config.includeSystemDefaults(expandedjobs) # Resolve "let"-Keys config.resolveMacros(expandedjobs) # Resolve libs/Manifests config.resolveLibs(expandedjobs) # To see fully expanded config: # console.info(pprint.pformat(config.get("."))) # Do some config schema checking config.checkSchema(expandedjobs, checkJobTypes=True) # Clean-up config config.cleanUpJobs(expandedjobs) # Reset console level console.setLevel(level) console.resetFilter() # Processing jobs... for job in expandedjobs: console.head("Executing: %s" % job.name, True) if options.config_verbose: console.setLevel("debug") console.debug("Expanded job config:") console.debug(pprint.pformat(config.getJob(job).getData())) console.setLevel(level) ctx = context.copy() ctx['jobconf'] = config.getJob(job) Context.jobconf = ctx['jobconf'] generatorObj = Generator(ctx) generatorObj.run() return
def main(): global options (options, args) = GeneratorArguments(option_class=ExtendAction).parse_args(sys.argv[1:]) if args: options.jobs = args[0].split(',') else: options.jobs = [] # Initialize console if options.verbose: level = "debug" elif options.quiet: level = "warning" else: level = "info" console = Log(options.logfile, level) Context.console = console # Treat verbosity of pre-job processing if options.config_verbose: console.setLevel("debug") console.setFilter(["generator.config.*"]) else: console.setLevel("info") # Show progress indicator? console.progress_indication = options.show_progress_indicator # Initial user feedback appname = ((os.path.dirname(os.path.abspath(options.config)).split(os.sep)))[-1] console.head(u"Initializing: %s" % appname.decode('utf-8'), True) console.info(u"Processing configuration") console.debug(u" file: %s" % options.config) # Load application configuration config = Config(console, options.config, **options.letmacros) # Load user configuration (preferences) config = getUserConfig(config) # Insert remaining command line args config = getAdditonalArgs(config, args[1:]) # Early check for log filter -- doesn't work as there is no job selected yet #console.setFilter(config.get("log/filter/debug", [])) # Resolve "include"-Keys console.debug("Resolving config includes...") console.indent() config.resolveIncludes() console.outdent() # Check jobs availableJobs = config.getExportedJobsList() if len(options.jobs) == 0: default_job = config.get("default-job", "") if default_job: options.jobs.append(default_job) else: if not options.daemon: listJobs(console, availableJobs, config) sys.exit(1) else: for job in options.jobs: if job not in availableJobs: console.warn("No such job: %s" % job) listJobs(console, availableJobs, config) sys.exit(1) console.debug(u"Jobs: %s" % ", ".join(options.jobs)) context = {'config': config, 'console':console, 'jobconf':None, 'interruptRegistry':interruptRegistry} Context.config = config # TODO: clean up overlap between context dict and Context module # CLI mode if not options.daemon: # Resolve "extend"- and "run"-Keys expandedjobs = config.resolveExtendsAndRuns(options.jobs[:]) # Include system defaults config.includeSystemDefaults(expandedjobs) # Resolve "let"-Keys config.resolveMacros(expandedjobs) # Resolve libs/Manifests config.resolveLibs(expandedjobs) # To see fully expanded config: #console.info(pprint.pformat(config.get("."))) # Do some config schema checking config.checkSchema(expandedjobs, checkJobTypes=True) # Clean-up config config.cleanUpJobs(expandedjobs) # Reset console level console.setLevel(level) console.resetFilter() # Processing jobs... for job in expandedjobs: console.head("Executing: %s" % job.name, True) if options.config_verbose: console.setLevel("debug") console.debug("Expanded job config:") console.debug(pprint.pformat(config.getJob(job).getData())) console.setLevel(level) ctx = context.copy() ctx['jobconf'] = config.getJob(job) Context.jobconf = ctx['jobconf'] generatorObj = Generator(ctx) generatorObj.run() # Daemon mode else: from generator.runtime.Generatord import Generatord console.head("Executing: Daemon Mode", True) generatord = Generatord(context) console.info("Opening port %s on %s, serving in background..." % (generatord.servAddr[1], generatord.servAddr[0] if generatord.servAddr[0] else 'localhost') ) generatord.serve()
import sys import optparse import codecs import copy import tempfile scriptDir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(scriptDir, "../../pylib")) import demjson from generator.runtime.Log import Log from generator.runtime.ShellCmd import ShellCmd from misc import filetool global console console = Log(None, "info") global shell shell = ShellCmd() qxPatchReleases = { "3.0": "3.0.2", "2.1": "2.1.1", "2.0": "2.0.4", "1.6": "1.6.1", "1.5": "1.5.1", "1.4": "1.4.2", "1.3": "1.3.1", "1.2": "1.2.2", "1.1": "1.1.2", "1.0": "1.0.2" }
def main(): global options parser = optparse.OptionParser(option_class=ExtendAction) usage_str = '''%prog [options] job,... Arguments: job,... a list of jobs (like 'source' or 'copy-files', without the quotes) to run x use 'x' (or some undefined job name) to get a list of all available jobs from the configuration file''' parser.set_usage(usage_str) # Common options parser.add_option("-c", "--config", dest="config", metavar="CFGFILE", default="config.json", help="path to configuration file containing job definitions (default: %default)") parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, help="quiet output mode (extra quiet)") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose output mode of job processing") parser.add_option("-w", "--config-verbose", action="store_true", dest="config_verbose", default=False, help="verbose output mode of configuration processing") parser.add_option("-l", "--logfile", dest="logfile", metavar="FILENAME", default=None, type="string", help="log file") parser.add_option("-s", "--stacktrace", action="store_true", dest="stacktrace", default=False, help="enable stack traces on fatal exceptions") parser.add_option("-m", "--macro", dest="letmacros", metavar="KEY:VAL", action="map", type="string", default={}, help="define/overwrite a global 'let' macro KEY with value VAL") # Dynamic options (currently not supported) #parser.add_option("--setting", action="extend", dest="settings", metavar="KEY:VALUE", type="string", default=[], help="Used settings") #parser.add_option("--variant", action="extend", dest="variants", metavar="KEY:VALUE", type="string", default=[], help="Selected variants") #parser.add_option("--require", action="extend", dest="require", metavar="CLASS1:CLASS2", type="string", default=[], help="Special loadtime class dependencies") #parser.add_option("--use", action="extend", dest="use", metavar="CLASS1:CLASS2", type="string", default=[], help="Special runtime class dependencies") (options, args) = parser.parse_args(sys.argv[1:]) if args: options.jobs = args[0].split(',') else: options.jobs = [] # Initialize console if options.verbose: level = "debug" elif options.quiet: level = "warning" else: level = "info" console = Log(options.logfile, level) Context.console = console # Treat verbosity of pre-job processing if options.config_verbose: console.setLevel("debug") console.setFilter(["generator.config.*"]) else: console.setLevel("info") # Initial user feedback appname = ((os.path.dirname(os.path.abspath(options.config)).split(os.sep)))[-1] console.head(u"Initializing: %s" % appname.decode('utf-8'), True) console.info(u"Configuration: %s" % options.config) # Load application configuration config = Config(console, options.config, **options.letmacros) # Load user configuration (preferences) config = getUserConfig(config) # Insert remaining command line args config = getAdditonalArgs(config, args[1:]) # Early check for log filter -- doesn't work as there is no job selected yet #console.setFilter(config.get("log/filter/debug", [])) # Resolve "include"-Keys console.info("Resolving config includes...") console.indent() config.resolveIncludes() console.outdent() # Check jobs availableJobs = config.getExportedJobsList() if len(options.jobs) == 0: default_job = config.get("default-job", "") if default_job: options.jobs.append(default_job) else: listJobs(console, availableJobs, config) sys.exit(1) else: for job in options.jobs: if job not in availableJobs: console.warn("No such job: %s" % job) listJobs(console, availableJobs, config) sys.exit(1) console.info(u"Jobs: %s" % ", ".join(options.jobs)) # Resolve "extend"- and "run"-Keys expandedjobs = config.resolveExtendsAndRuns(options.jobs[:]) # Include system defaults config.includeSystemDefaults(expandedjobs) # Resolve "let"-Keys config.resolveMacros(expandedjobs) # Resolve libs/Manifests config.resolveLibs(expandedjobs) # To see fully expanded config: #console.info(pprint.pformat(config.get("."))) # Do some config schema checking config.checkSchema(expandedjobs, checkJobTypes=True) # Clean-up config config.cleanUpJobs(expandedjobs) # Reset console level console.setLevel(level) console.resetFilter() # Processing jobs... context = {'config': config, 'console':console, 'jobconf':None, 'interruptRegistry':interruptRegistry} for job in expandedjobs: console.head("Executing: %s" % job.name, True) if options.config_verbose: console.setLevel("debug") console.debug("Expanded job config:") console.debug(pprint.pformat(config.getJob(job).getData())) console.setLevel(level) ctx = context.copy() ctx['jobconf'] = config.getJob(job) generatorObj = Generator(ctx) generatorObj.run()
def main(): parser = optparse.OptionParser() parser.set_usage('''\ %prog --name APPLICATIONNAME [--out DIRECTORY] [--namespace NAMESPACE] [--type TYPE] [-logfile LOGFILE] [--skeleton-path PATH] Script to create a new qooxdoo application. Example: For creating a regular GUI application \'myapp\' you could execute: %prog --name myapp''') parser.add_option( "-n", "--name", dest="name", metavar="APPLICATIONNAME", help="Name of the application. An application folder with identical name will be created. (Required)" ) parser.add_option( "-o", "--out", dest="out", metavar="DIRECTORY", default=".", help="Output directory for the application folder. (Default: %default)" ) parser.add_option( "-s", "--namespace", dest="namespace", metavar="NAMESPACE", default=None, help="Applications's top-level namespace. (Default: APPLICATIONNAME)" ) parser.add_option( "-t", "--type", dest="type", metavar="TYPE", default="gui", help="Type of the application to create, one of: "+str(map(str, sorted(APP_INFOS.keys())))+"." + str(", ".join(["'%s' %s" % (x, y) for x,y in sorted(APP_INFOS.items())])) + ". (Default: %default)" ) parser.add_option( "-l", "--logfile", dest="logfile", metavar="LOGFILE", default=None, type="string", help="Log file" ) parser.add_option( "-p", "--skeleton-path", dest="skeleton_path", metavar="PATH", default=SKELETON_DIR, help="(Advanced) Path where the script looks for skeletons. " + "The directory must contain sub directories named by " + "the application types. (Default: %default)" ) parser.add_option( "--cache", dest="cache", metavar="PATH", default="${TMPDIR}/cache", help="Path to the cache directory; will be entered into config.json's CACHE macro (Default: %default)" ) (options, args) = parser.parse_args(sys.argv[1:]) if not options.name: parser.print_help() sys.exit(1) else: options.name = options.name.decode('utf-8') # Initialize console global console console = Log(options.logfile, "info") if not options.namespace: if R_ILLEGAL_NS_CHAR.search(options.name): convertedName = R_ILLEGAL_NS_CHAR.sub("_", options.name) console.log("WARNING: Converted illegal characters in name (from %s to %s)" % (options.name, convertedName)) options.name = convertedName options.namespace = convertedName.lower() else: options.namespace = options.name.lower() else: options.namespace = options.namespace.decode('utf-8') if R_ILLEGAL_NS_CHAR.search(options.namespace): convertedNamespace = R_ILLEGAL_NS_CHAR.sub("_", options.namespace) console.log("WARNING: Converted illegal characters in namespace (from %s to %s)" % (options.namespace, convertedNamespace)) options.namespace = convertedNamespace getQxVersion() createApplication(options) console.log("DONE")
def main(): global options parser = optparse.OptionParser(option_class=ExtendAction) usage_str = '''%prog [options] job,... Arguments: job,... a list of jobs (like 'source' or 'copy-files', without the quotes) to run x use 'x' (or some undefined job name) to get a list of all available jobs from the configuration file''' parser.set_usage(usage_str) # Common options parser.add_option( "-c", "--config", dest="config", metavar="CFGFILE", default="config.json", help= "path to configuration file containing job definitions (default: %default)" ) parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, help="quiet output mode (extra quiet)") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose output mode of job processing") parser.add_option("-w", "--config-verbose", action="store_true", dest="config_verbose", default=False, help="verbose output mode of configuration processing") parser.add_option("-l", "--logfile", dest="logfile", metavar="FILENAME", default=None, type="string", help="log file") parser.add_option("-s", "--stacktrace", action="store_true", dest="stacktrace", default=False, help="enable stack traces on fatal exceptions") parser.add_option( "-m", "--macro", dest="letmacros", metavar="KEY:VAL", action="map", type="string", default={}, help="define/overwrite a global 'let' macro KEY with value VAL") # Dynamic options (currently not supported) #parser.add_option("--setting", action="extend", dest="settings", metavar="KEY:VALUE", type="string", default=[], help="Used settings") #parser.add_option("--variant", action="extend", dest="variants", metavar="KEY:VALUE", type="string", default=[], help="Selected variants") #parser.add_option("--require", action="extend", dest="require", metavar="CLASS1:CLASS2", type="string", default=[], help="Special loadtime class dependencies") #parser.add_option("--use", action="extend", dest="use", metavar="CLASS1:CLASS2", type="string", default=[], help="Special runtime class dependencies") (options, args) = parser.parse_args(sys.argv[1:]) if args: options.jobs = args[0].split(',') else: options.jobs = [] # Initialize console if options.verbose: level = "debug" elif options.quiet: level = "warning" else: level = "info" console = Log(options.logfile, level) Context.console = console # Treat verbosity of pre-job processing if options.config_verbose: console.setLevel("debug") console.setFilter(["generator.config.*"]) else: console.setLevel("info") # Initial user feedback appname = ((os.path.dirname(os.path.abspath(options.config)).split( os.sep)))[-1] console.head(u"Initializing: %s" % appname.decode('utf-8'), True) console.info(u"Configuration: %s" % options.config) # Load application configuration config = Config(console, options.config, **options.letmacros) # Load user configuration (preferences) config = getUserConfig(config) # Insert remaining command line args config = getAdditonalArgs(config, args[1:]) # Early check for log filter -- doesn't work as there is no job selected yet #console.setFilter(config.get("log/filter/debug", [])) # Resolve "include"-Keys console.info("Resolving config includes...") console.indent() config.resolveIncludes() console.outdent() # Check jobs availableJobs = config.getExportedJobsList() if len(options.jobs) == 0: default_job = config.get("default-job", "") if default_job: options.jobs.append(default_job) else: listJobs(console, availableJobs, config) sys.exit(1) else: for job in options.jobs: if job not in availableJobs: console.warn("No such job: %s" % job) listJobs(console, availableJobs, config) sys.exit(1) console.info(u"Jobs: %s" % ", ".join(options.jobs)) # Resolve "extend"- and "run"-Keys expandedjobs = config.resolveExtendsAndRuns(options.jobs[:]) # Include system defaults config.includeSystemDefaults(expandedjobs) # Resolve "let"-Keys config.resolveMacros(expandedjobs) # Resolve libs/Manifests config.resolveLibs(expandedjobs) # To see fully expanded config: #console.info(pprint.pformat(config.get("."))) # Do some config schema checking config.checkSchema(expandedjobs, checkJobTypes=True) # Clean-up config config.cleanUpJobs(expandedjobs) # Reset console level console.setLevel(level) console.resetFilter() # Processing jobs... context = { 'config': config, 'console': console, 'jobconf': None, 'interruptRegistry': interruptRegistry } for job in expandedjobs: console.head("Executing: %s" % job.name, True) if options.config_verbose: console.setLevel("debug") console.debug("Expanded job config:") console.debug(pprint.pformat(config.getJob(job).getData())) console.setLevel(level) ctx = context.copy() ctx['jobconf'] = config.getJob(job) generatorObj = Generator(ctx) generatorObj.run()
import sys, os, re, random, codecs, urllib import qxenviron import util import reporting from seleniumserver import SeleniumServer from build import Builder from lint import Lint binPath = os.path.abspath(os.path.join(os.pardir, os.pardir, "bin")) sys.path.append(binPath) from logFormatter import QxLogFormat from simulationLogParser import SimulationLogParser from generator.runtime.Log import Log log = Log(None, "debug") class TestRun: def __init__(self, config, simulate=False, logger=log): self.configuration = config if self.getConfigSetting("base/type", "") == "standalone-generator": self.configuration = self.getConfigFromGenerator() self.log = logger self.simulate = simulate self.startDate = util.getTimestamp() self.buildStatus = {} if "base" in self.configuration: self.configuration["base"]["testHostName"] = util.getHostName() self.log.info("New test run started on %s" % self.startDate)
def main(): parser = optparse.OptionParser(option_class=ExtendAction) usage_str = '''%prog [options] file.js,...''' parser.set_usage(usage_str) # General flags parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose output mode (extra verbose)") parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, help="quiet output") # Optimization flags parser.add_option("-n", "--variables", action="store_true", dest="variables", default=False, help="optimize variables") parser.add_option("-s", "--strings", action="store_true", dest="strings", default=False, help="optimize strings") parser.add_option("-p", "--privates", action="store_true", dest="privates", default=False, help="optimize privates") parser.add_option("-b", "--basecalls", action="store_true", dest="basecalls", default=False, help="optimize basecalls") parser.add_option("-i", "--inline", action="store_true", dest="inline", default=False, help="optimize inline") parser.add_option("--all", action="store_true", dest="all", default=False, help="optimize all") # Variant support parser.add_option("--variant", action="extend", dest="variants", metavar="KEY:VALUE", type="string", default=[], help="Selected variants") # Action modifier parser.add_option("--pretty", action="store_true", dest="pretty", default=False, help="print out pretty printed") parser.add_option("--tree", action="store_true", dest="tree", default=False, help="print out tree") parser.add_option("--lint", action="store_true", dest="lint", default=False, help="ecmalint the file") # Cache support parser.add_option("-c", "--cache", dest="cache", metavar="CACHEPATH", type="string", default="", help="path to cache directory") parser.add_option("--privateskey", dest="privateskey", metavar="CACHEKEY", type="string", default="", help="cache key for privates") # # Process arguments # (options, args) = parser.parse_args(sys.argv[1:]) if len(args) == 0: print ">>> Missing filename!" return if not options.quiet: print ">>> Parsing file..." fileName = args[0] fileContent = filetool.read(fileName, "utf-8") fileId = "xxx" tokens = tokenizer.parseStream(fileContent, fileName) if not options.quiet: print ">>> Creating tree..." tree = treegenerator.createSyntaxTree(tokens) # # Optimizing tree # if len(options.variants) > 0: if not options.quiet: print ">>> Selecting variants..." varmap = {} for entry in options.variants: pos = entry.index(":") varmap[entry[0:pos]] = entry[pos + 1:] variantoptimizer.search(tree, varmap, fileId) if options.all or options.basecalls: if not options.quiet: print ">>> Optimizing basecalls..." basecalloptimizer.patch(tree) if options.all or options.inline: if not options.quiet: print ">>> Optimizing inline..." inlineoptimizer.patch(tree) if options.all or options.strings: if not options.quiet: print ">>> Optimizing strings..." _optimizeStrings(tree, fileId) if options.all or options.variables: if not options.quiet: print ">>> Optimizing variables..." variableoptimizer.search(tree) if options.all or options.privates: if not options.quiet: print ">>> Optimizing privates..." if options.cache: cache = Cache(options.cache, Log()) privates, _ = cache.read(options.privateskey) if privates != None: privateoptimizer.load(privates) privateoptimizer.patch(tree, fileId) if options.cache: cache.write(options.privateskey, privateoptimizer.get()) # # Output the result # if options.lint: if not options.quiet: print ">>> Executing ecmalint..." print "Needs implementation" elif options.tree: if not options.quiet: print ">>> Printing out tree..." print tree.toXml().encode('utf-8') else: if not options.quiet: print ">>> Compiling..." compiled = _compileTree(tree, options.pretty) print compiled.encode('utf-8')
def main(argv=None): # init Context module Context.console = Log() Context.jobconf = {} if argv is None: argv = sys.argv parser = OptionParser( description="Checks ECMAScript/JavaScript files for common errors.") parser.add_option( "--action", "-a", dest="actions", metavar="ACTION", choices=[ "ALL", "undefined_variables", "unused_variables", "multidefined_variables", "maps", "blocks", "fields" ], action="append", default=[], help= """Performs the given checks on the input files. This parameter may be supplied multiple times. Valid arguments are: "ALL" (default): Perform all checks "undefined_variables": Look for identifier, which are referenced in the global scope. This action can find misspelled identifier and missing 'var' statements. You can use the '-g' flag to add valid global identifiers. "unused_variables": Look for identifier, which are defined but never used. "multidefined_variables": Look for identifier, which are defined multiple times. "blocks" : Look for single statments in bodies of if's and loops that are not enclosed by braces. "fields" : Look for class attributes, checking definedness, privates and protected fields. "maps": Look for duplicate keys in map declarations. """) parser.add_option("-g", dest="globals", help="Add an allowed global identifier GLOBAL", metavar="GLOBAL", action="append", default=[]) (options, args) = parser.parse_args(argv) if len(args) == 1: parser.print_help() sys.exit(1) if options.globals: globals_ = options.globals else: globals_ = [] checkAll = "ALL" in options.actions or len(options.actions) == 0 # construct opts argument for lint_check keys_map ={ # map cli 'action' keys to lint.options "undefined_variables" : ["ignore_undefined_globals"], "unused_variables" : ["ignore_unused_variables", "ignore_unused_parameter"], "multidefined_variables" : ["ignore_multiple_vardecls"], "maps" : ["ignore_multiple_mapkeys"], "blocks" : ["ignore_no_loop_block"], "fields" : ["ignore_reference_fields", "ignore_undeclared_privates"], } opts = lint.defaultOptions() opts.allowed_globals = options.globals for opt in (o for o in vars(opts) if o.startswith("ignore_")): if checkAll: setattr(opts, opt, False) else: for argopt in keys_map: if argopt in options.actions and opt in keys_map[argopt]: setattr(opts, opt, False) break else: setattr(opts, opt, True) for filename in args[1:]: tree_ = treegenerator.createFileTree_from_string( codecs.open(filename, "r", "utf-8").read()) tree_ = scopes.create_scopes(tree_) lint.lint_check(tree_, filename, opts) return ## TODO: rc
def main(): global options (options, args) = GeneratorArguments(option_class=ExtendAction).parse_args(sys.argv[1:]) if args: options.jobs = args[0].split(",") else: options.jobs = [] # Save cli options to Context gen_opts = [x for x in sys.argv[1:] if x not in args] # cli options without jobs list Context.generator_opts = gen_opts # as list # Initialize console if options.verbose: level = "debug" elif options.quiet: level = "warning" else: level = "info" console = Log(options.logfile, level) Context.console = console # Treat verbosity of pre-job processing if options.config_verbose: console.setLevel("debug") console.setFilter(["generator.config.*"]) else: console.setLevel("info") # Show progress indicator? console.progress_indication = options.show_progress_indicator # Initial user feedback appname = ((os.path.dirname(os.path.abspath(options.config)).split(os.sep)))[-1] console.head(u"Initializing: %s" % appname.decode("utf-8"), True) console.info(u"Processing configuration") console.debug(u" file: %s" % options.config) # Load application configuration config = Config(console, options.config, **options.letmacros) # Load user configuration (preferences) config = getUserConfig(config) # Insert remaining command line args config = getAdditonalArgs(config, args[1:]) # Early check for log filter -- doesn't work as there is no job selected yet # console.setFilter(config.get("log/filter/debug", [])) # Resolve "include"-Keys console.debug("Resolving config includes...") console.indent() config.resolveIncludes() console.outdent() # Check jobs availableJobs = config.getExportedJobsList() if len(options.jobs) == 0: default_job = config.get("default-job", "") if default_job: options.jobs.append(default_job) else: listJobs(console, availableJobs, config) sys.exit(1) elif "_all_" in options.jobs: options.jobs = [] for job in availableJobs: if job not in _ALL_SKIP_JOBS: options.jobs.append(job) else: for job in options.jobs: if job not in availableJobs: console.warn("No such job: %s" % job) listJobs(console, availableJobs, config) sys.exit(1) console.debug(u"Jobs: %s" % ", ".join(options.jobs)) context = {"config": config, "console": console, "jobconf": None, "interruptRegistry": interruptRegistry} Context.config = config # TODO: clean up overlap between context dict and Context module # Resolve "extend"- and "run"-Keys expandedjobs = config.resolveExtendsAndRuns(options.jobs[:]) # Include system defaults config.includeSystemDefaults(expandedjobs) # Resolve "let"-Keys config.resolveMacros(expandedjobs) # Resolve libs/Manifests config.resolveLibs(expandedjobs) # To see fully expanded config: # console.info(pprint.pformat(config.get("."))) # Do some config schema checking config.checkSchema(expandedjobs, checkJobTypes=True) # Clean-up config config.cleanUpJobs(expandedjobs) # Reset console level console.setLevel(level) console.resetFilter() # Processing jobs... for job in expandedjobs: console.head("Executing: %s" % job.name, True) if options.config_verbose: console.setLevel("debug") console.debug("Expanded job config:") console.debug(pprint.pformat(config.getJob(job).getData())) console.setLevel(level) ctx = context.copy() ctx["jobconf"] = config.getJob(job) Context.jobconf = ctx["jobconf"] generatorObj = Generator(ctx) generatorObj.run() return
def main(): parser = optparse.OptionParser() parser.set_usage('''\ %prog --name APPLICATIONNAME [--out DIRECTORY] [--namespace NAMESPACE] [--type TYPE] [-logfile LOGFILE] [--skeleton-path PATH] Script to create a new qooxdoo application. Example: For creating a regular GUI application \'myapp\' you could execute: %prog --name myapp''') parser.add_option( "-n", "--name", dest="name", metavar="APPLICATIONNAME", help= "Name of the application. An application folder with identical name will be created. (Required)" ) parser.add_option( "-o", "--out", dest="out", metavar="DIRECTORY", default=".", help="Output directory for the application folder. (Default: %default)" ) parser.add_option( "-s", "--namespace", dest="namespace", metavar="NAMESPACE", default=None, help="Applications's top-level namespace. (Default: APPLICATIONNAME)") parser.add_option( "-t", "--type", dest="type", metavar="TYPE", default="gui", help="Type of the application to create, one of: " + str(APP_TYPES) + "." + "'gui' builds a standard qooxdoo GUI application, " + "'with-contrib' builds a standard qooxdoo GUI application that " + "also uses a qooxdoo-contrib library, " + "'migration' should " + "be used to migrate qooxdoo 0.7 applications and " + "'bom' can be used " + "to build low-level qooxdoo applications. (Default: %default)") parser.add_option("-l", "--logfile", dest="logfile", metavar="LOGFILE", default=None, type="string", help="Log file") parser.add_option( "-p", "--skeleton-path", dest="skeleton_path", metavar="PATH", default=SKELETON_DIR, help="(Advanced) Path where the script looks for skeletons. " + "The directory must contain sub directories named by " + "the application types. (Default: %default)") (options, args) = parser.parse_args(sys.argv[1:]) if not options.name: parser.print_help() sys.exit(1) if not options.namespace: options.namespace = options.name.lower().replace(" ", "_") # Initialize console global console console = Log(options.logfile, "info") createApplication(options.name, options.out, options.namespace, options.type, options.skeleton_path) console.log("DONE")
def _initialize(): global config global console global level # Initialize console if options.verbose: level = "debug" elif options.quiet: level = "warning" else: level = "info" console = Log(options.logfile, level) Context.console = console # Treat verbosity of pre-job processing if options.config_verbose: console.setLevel("debug") console.setFilter(["generator.config.*"]) else: console.setLevel("info") # Initial user feedback appname = ((os.path.dirname(os.path.abspath(options.config)).split(os.sep)))[-1] console.head(u"Initializing: %s" % appname.decode('utf-8'), True) console.info(u"Configuration: %s" % options.config) # Load application configuration config = Config(console, options.config, **options.letmacros) # Load user configuration (preferences) config = getUserConfig(config) # Insert remaining command line args config = getAdditonalArgs(config, args[1:]) # Early check for log filter -- doesn't work as there is no job selected yet #console.setFilter(config.get("log/filter/debug", [])) # Resolve "include"-Keys console.info("Resolving config includes...") console.indent() config.resolveIncludes() console.outdent()