def main(args=None, loger=None):
  if not args:
    args = sys.argv
  config_loader = get_config_loader(args)
  Workspace.set(os.path.dirname(config_loader.config_file))
  custom_bundles = get_additional_bundles(args)
  custom_vars = get_additional_vars(args)
  if custom_bundles:
    config_loader.append_bundles(*custom_bundles)
  if custom_vars:
    config_loader.append_vars(*custom_vars)
  is_outside_loger = True
  if not loger:
    is_outside_loger = False
    loger = get_logger(args)
  builder = AppConfigurator(config_loader, loger, verbose=is_verbose(args), debug_mode=False)
  execution_dir = None
  if "-dir" in args:
    execution_dir = args[args.index("-dir") + 1]
    ex_dir_expanded = os.path.abspath(os.path.expanduser(execution_dir))
    builder.set_execution_dir(ex_dir_expanded)
  validator = ConfigurationValidator(config_loader.config_file)
  validation_result = validator.validate(config_loader.load_config(), ex_dir_expanded)

  if validation_result.is_valid:
    builder.exclude_bundles(get_excluded_bundles(args))
    builder.include_bundles(get_included_bundles(args))
    builder.apply()
    if not is_outside_loger:
      builder.logger.close()
  else:
    builder.logger.write(str(validation_result))
    if not is_outside_loger:
      builder.logger.close()
def main():
  print "Starting Configurator"
  print "Version", app_config.get_version()
  config_loader = get_config_loader()
  Workspace.set(os.path.dirname(config_loader.config_file))
  custom_bundles = get_additional_bundles()
  custom_vars = get_additional_vars(sys.argv)
  if custom_bundles:
    config_loader.append_bundles(*custom_bundles)
  if custom_vars:
    config_loader.append_vars(*custom_vars)

  builder = AppConfigurator(config_loader, get_logger(), verbose=is_verbose(), debug_mode=False)
  execution_dir = None
  if "-dir" in sys.argv:
    execution_dir = sys.argv[sys.argv.index("-dir") + 1]
    ex_dir_expanded = os.path.abspath(os.path.expanduser(execution_dir))
    builder.set_execution_dir(ex_dir_expanded)
  validator = ConfigurationValidator(config_loader.config_file)
  validation_result = validator.validate(config_loader.load_config(), ex_dir_expanded)

  if validation_result.is_valid:
    builder.exclude_bundles(get_excluded_bundles())
    builder.include_bundles(get_included_bundles())
    builder.apply()
    builder.logger.close()
  else:
    builder.logger.write(str(validation_result))
    builder.logger.close()
    sys.exit(1)
Esempio n. 3
0
 def on_run_click(self):
   root_url = os.path.dirname(self.config_path)
   if os.name!='posix':
     root_url = '/'+root_url
   if self.build_output:
     self.build_output.close()
   self.build_output = ConsoleOutput()
   self.build_output.show()
   config_loader = FileConfigLoader(self.config_path)
   builder = AppConfigurator(config_loader, ZmqChainedLoger(1234))
   builder.set_execution_dir(self.working_dir)
   builder.include_bundles(self.get_included_bundles())
   self.set_message_receiver()
   #builder.apply()
   self.worker = ConfigRunnerThread(builder)
   self.worker.start()
   self.worker.finished.connect(self.on_worker_finished)
Esempio n. 4
0
 def on_run_click(self):
     root_url = os.path.dirname(self.config_path)
     if os.name != 'posix':
         root_url = '/' + root_url
     if self.build_output:
         self.build_output.close()
     self.build_output = ConsoleOutput()
     self.build_output.show()
     config_loader = FileConfigLoader(self.config_path)
     builder = AppConfigurator(config_loader,
                               ZmqChainedLoger(1234),
                               verbose=self.verbose)
     builder.set_execution_dir(self.working_dir)
     builder.include_bundles(self.get_included_bundles())
     self.set_message_receiver()
     if self.debug:
         builder.apply()
     else:
         self.worker = ConfigRunnerThread(builder)
         self.worker.start()
         self.worker.finished.connect(self.on_worker_finished)
def main(args=None, loger=None):
    if not args:
        args = sys.argv
    config_loader = get_config_loader(args)
    Workspace.set(os.path.dirname(config_loader.config_file))
    custom_bundles = get_additional_bundles(args)
    custom_vars = get_additional_vars(args)
    if custom_bundles:
        config_loader.append_bundles(*custom_bundles)
    if custom_vars:
        config_loader.append_vars(*custom_vars)
    is_outside_loger = True
    if not loger:
        is_outside_loger = False
        loger = get_logger(args)
    builder = AppConfigurator(config_loader,
                              loger,
                              verbose=is_verbose(args),
                              debug_mode=False)
    execution_dir = None
    if "-dir" in args:
        execution_dir = args[args.index("-dir") + 1]
        ex_dir_expanded = os.path.abspath(os.path.expanduser(execution_dir))
        builder.set_execution_dir(ex_dir_expanded)
    validator = ConfigurationValidator(config_loader.config_file)
    validation_result = validator.validate(config_loader.load_config(),
                                           ex_dir_expanded)

    if validation_result.is_valid:
        builder.exclude_bundles(get_excluded_bundles(args))
        builder.include_bundles(get_included_bundles(args))
        builder.apply()
        if not is_outside_loger:
            builder.logger.close()
    else:
        builder.logger.write(str(validation_result))
        if not is_outside_loger:
            builder.logger.close()