From: Christian Van Wambeke Date: Thu, 3 May 2018 11:54:12 +0000 (+0200) Subject: fix sat config -i X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8a64758ef87498687d20b7d9caccc8990ac83899;p=tools%2Fsat.git fix sat config -i --- diff --git a/commands/application.py b/commands/application.py index 32b2e1e..5d0d5bd 100644 --- a/commands/application.py +++ b/commands/application.py @@ -108,7 +108,8 @@ Note: this command will ssh to retrieve information to each machine in the l msg = _("The section APPLICATION.virtual_app is not defined in the product.") logger.error(UTS.red(msg)) return RCO.ReturnCode("KO", msg) - + virtual_app = config.APPLICATION.virtual_app + # get application dir target_dir = config.APPLICATION.workdir if options.target: @@ -116,16 +117,15 @@ Note: this command will ssh to retrieve information to each machine in the l # set list of modules if options.modules: - config.APPLICATION.virtual_app['modules'] = options.modules + virtual_app['modules'] = options.modules # set name and application_name if options.name: - config.APPLICATION.virtual_app['name'] = options.name - config.APPLICATION.virtual_app['application_name'] = options.name + "_appdir" + virtual_app['name'] = options.name + virtual_app['application_name'] = options.name + "_appdir" - application_name = src.get_cfg_param(config.APPLICATION.virtual_app, - "application_name", - config.APPLICATION.virtual_app.name + "_appdir") + default = config.APPLICATION.virtual_app.name + "_appdir" + application_name = UTS.get_config_key(virtual_app, "application_name", default) appli_dir = os.path.join(target_dir, application_name) fmt = " %s = %s\n" # as " label = value\n" @@ -139,21 +139,18 @@ Note: this command will ssh to retrieve information to each machine in the l elif options.gencat: # generate catalog for given list of computers catalog_src = options.gencat - catalog = generate_catalog(options.gencat.split(","), - config,logger) - elif 'catalog' in config.APPLICATION.virtual_app: + catalog = generate_catalog(options.gencat.split(","), config,logger) + elif 'catalog' in virtual_app: # use catalog specified in the product - if config.APPLICATION.virtual_app.catalog.endswith(".xml"): + if virtual_app.catalog.endswith(".xml"): # catalog as a file - catalog = config.APPLICATION.virtual_app.catalog + catalog = virtual_app.catalog else: # catalog as a list of computers - catalog_src = config.APPLICATION.virtual_app.catalog - mlist = filter(lambda l: len(l.strip()) > 0, - config.APPLICATION.virtual_app.catalog.split(",")) + catalog_src = virtual_app.catalog + mlist = filter(lambda l: len(l.strip()) > 0, virtual_app.catalog.split(",")) if len(mlist) > 0: - catalog = generate_catalog(config.APPLICATION.virtual_app.catalog.split(","), - config, logger) + catalog = generate_catalog(virtual_app.catalog.split(","), config, logger) # display which catalog is used if len(catalog) > 0: @@ -250,7 +247,7 @@ def create_config_file(config, modules, env_file, logger): else: # regular module mp = mm.install_dir - gui = src.get_cfg_param(mm, "has_gui", "yes") + gui = UTS.get_config_key(mm, "has_gui", "yes") flagline = add_module_to_appli(f, m, gui, mp, logger, flagline) f.write('\n') diff --git a/commands/check.py b/commands/check.py index a3d8b84..bb7bd93 100644 --- a/commands/check.py +++ b/commands/check.py @@ -195,7 +195,7 @@ def check_product(p_name_info, config, logger): cmd_found = True command = "" if src.product.product_has_script(p_info) and not ignored: - command = src.get_cfg_param(p_info, "test_build", "Not found") + command = UTS.get_config_key(p_info, "test_build", "Not found") if command == "Not found": cmd_found = False msg = _("""\ diff --git a/commands/config.py b/commands/config.py index 48da2ca..2cfedee 100644 --- a/commands/config.py +++ b/commands/config.py @@ -137,13 +137,15 @@ If a name is given the new config file takes the given name.""")) # case : give information about the product in parameter elif options.info: - src.check_config_has_application(config) - if options.info in config.APPLICATION.products: - show_product_info(config, options.info, logger) - return RCO.ReturnCode("OK", "options.info") - raise Exception( - _("%(product_name)s is not a product of %(application_name)s.") % \ - {'product_name' : options.info, 'application_name' : config.VARS.application} ) + UTS.check_config_has_application(config).raiseIfKo() + cfg_products = config.APPLICATION.products + if options.info in cfg_products: + CFGMGR.show_product_info(config, options.info, logger) + return RCO.ReturnCode("OK", "product '%s' found in products" % options.info) + msg = _("product '%s' is not defined in application '%s'.") % \ + (options.info, config.VARS.application) + logger.error(msg) + return RCO.ReturnCode("KO", msg) # case : copy an existing .pyconf # to ~/.salomeTools/Applications/LOCAL_.pyconf @@ -220,10 +222,10 @@ If a name is given the new config file takes the given name.""")) # case : give a synthetic view of all patches used in the application elif options.show_patchs: - src.check_config_has_application(config) + UTS.check_config_has_application(config).raiseIfKo() # Print some informations logger.info(_('Show the patchs of application %s\n') % \ - UTS.label(config.VARS.application)) + UTS.label(config.VARS.application)) show_patchs(config, logger) # case: print all the products name of the application (internal use for completion) diff --git a/commands/find_duplicates.py b/commands/find_duplicates.py index e5b7e9f..de50ddb 100644 --- a/commands/find_duplicates.py +++ b/commands/find_duplicates.py @@ -109,14 +109,15 @@ class Command(_BaseCommand): if options.path: l_dir_path = options.path else: - src.check_config_has_application(config) + UTS.check_config_has_application(config).raiseIfKo() + cfg_APP = config.APPLICATION if options.sources: - l_dir_path = [os.path.join(config.APPLICATION.workdir, "SOURCES")] + l_dir_path = [os.path.join(cfg_APP.workdir, "SOURCES")] else: # find all installation paths - all_products = config.APPLICATION.products.keys() + all_products = cfg_APP.products.keys() l_product_cfg = src.product.get_products_infos(all_products, config) - l_dir_path = [pi.install_dir for __, pi in l_product_cfg] + l_dir_path = [pi.install_dir for tmp, pi in l_product_cfg] # Get the files to ignore during the searching files_ignored = default_files_ignored @@ -218,7 +219,7 @@ class Command(_BaseCommand): msg += rep + " " logger.info(msg + "\n") - return 0 + return RCO.ReturnCode("OK", "find_duplicates command done") def list_directory(lpath, extension_ignored, files_ignored, directories_ignored): diff --git a/commands/generate.py b/commands/generate.py index c63ce25..f6033ce 100644 --- a/commands/generate.py +++ b/commands/generate.py @@ -70,7 +70,7 @@ class Command(_BaseCommand): options = self.getOptions() # Check that the command has been called with an application - src.check_config_has_application(config) + UTS.check_config_has_application(config).raiseIfKo() logger.info( _('Generation of SALOME modules for application %s\n') % \ UTS.label(config.VARS.application) ) diff --git a/commands/log.py b/commands/log.py index bca0a9a..b25d085 100644 --- a/commands/log.py +++ b/commands/log.py @@ -160,7 +160,7 @@ class Command(_BaseCommand): # If the last option is invoked, just, show the last log file if options.last_terminal: - src.check_config_has_application(config) + UTS.check_config_has_application(config).raiseIfKo() rootLogDir = os.path.join(config.APPLICATION.workdir, 'LOGS') UTS.ensure_path_exists(rootLogDir) log_dirs = os.listdir(rootLogDir) diff --git a/commands/package.py b/commands/package.py index 7c8ddb6..9b62953 100644 --- a/commands/package.py +++ b/commands/package.py @@ -179,7 +179,7 @@ Use one of the following options: # if the package contains binaries or sources: if options.binaries or options.sources: # Check that the command has been called with an application - src.check_config_has_application(config) + UTS.check_config_has_application(config).raiseIfKo() # Display information logger.info(_("Packaging application %s\n") % \ @@ -1355,7 +1355,7 @@ def update_config(config, prop, value): :param prop: (str) The property to filter :param value: (str) The value of the property to filter """ - src.check_config_has_application(config) + UTS.check_config_has_application(config).raiseIfKo() l_product_to_remove = [] for product_name in config.APPLICATION.products.keys(): prod_cfg = src.product.get_product_config(config, product_name) diff --git a/commands/prepare.py b/commands/prepare.py index 1c23d64..0d3d40d 100644 --- a/commands/prepare.py +++ b/commands/prepare.py @@ -202,7 +202,7 @@ def find_products_with_patchs(l_products): l_res = [] for p_name_p_cfg in l_products: __, prod_cfg = p_name_p_cfg - l_patchs = src.get_cfg_param(prod_cfg, "patches", []) + l_patchs = UTS.get_config_key(prod_cfg, "patches", []) if len(l_patchs)>0: l_res.append(p_name_p_cfg) return l_res diff --git a/commands/profile.py b/commands/profile.py index 80b427c..82ee4e5 100644 --- a/commands/profile.py +++ b/commands/profile.py @@ -88,19 +88,19 @@ class Command(_BaseCommand): logger = self.getLogger() options = self.getOptions() - src.check_config_has_application(config) + UTS.check_config_has_application(config).raiseIfKo() if options.prefix is None: msg = _("The --%s argument is required\n") % "prefix" logger.error(msg) return RCO.ReturnCode("KO", msg) - retcode = generate_profile_sources(config, options, logger) + returnCode = generate_profile_sources(config, options, logger) if not options.no_update : update_pyconf(config, options) - return retcode + return returnCode # Class that overrides common.Reference diff --git a/commands/run.py b/commands/run.py index 3565ca5..62336fb 100644 --- a/commands/run.py +++ b/commands/run.py @@ -65,7 +65,7 @@ class Command(_BaseCommand): options = self.getOptions() # check for product - src.check_config_has_application(config) + UTS.check_config_has_application(config).raiseIfKo() # Determine launcher path launcher_name = src.get_launcher_name(config) @@ -74,8 +74,8 @@ class Command(_BaseCommand): # Check the launcher existence if launcher_name not in os.listdir(launcher_dir): message = _("""\ -The launcher %(1)s was not found in directory '%(2)s'. -Did you run the command 'sat launcher' ?\n""") % {"1": launcher_name, "2": launcher_dir} +The launcher %s was not found in directory '%s'. +Did you run the command 'sat launcher' ?""") % (launcher_name, launcher_dir) raise Exception(message) launcher_path = os.path.join(launcher_dir, launcher_name) diff --git a/data/local.pyconf b/data/local.pyconf index 88dff5c..9583550 100644 --- a/data/local.pyconf +++ b/data/local.pyconf @@ -12,13 +12,13 @@ { project_file_paths : [ - #"/volatile/wambeke/SAT5/SAT5_S840_MATIX24/SAT_SALOME/salome.pyconf", + "/volatile/wambeke/SAT5/SAT5_S840_MATIX24/SAT_SALOME/salome.pyconf", # "/home/uranietm/proJET/saTJOBS/saT5/uranie.pyconf", # cloned 2017/12 for matix - #"/home/matix/GitRepo/uranie/saT5/uranie.pyconf", - #"/volatile/wambeke/SAT5/SAT_MATIX/matix.pyconf" - "/home/christian/SAT_SALOME/salome.pyconf" - "/home/christian/SAT_MATIX/matix.pyconf" + "/home/matix/GitRepo/uranie/saT5/uranie.pyconf", + "/volatile/wambeke/SAT5/SAT_MATIX/matix.pyconf" + #"/home/christian/SAT_SALOME/salome.pyconf" + #"/home/christian/SAT_MATIX/matix.pyconf" #"/home/christian/SAT_MATIX" ] } diff --git a/src/coloringSat.py b/src/coloringSat.py index c7bb61d..b4f5eb3 100755 --- a/src/coloringSat.py +++ b/src/coloringSat.py @@ -65,7 +65,7 @@ Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. Style: DIM, NORMAL, BRIGHT, RESET_ALL -n.b. DIM is not assumed in win32 +note: DIM is not assumed in win32 """ # dir(ST) @@ -83,7 +83,7 @@ _tags = ( ("", ST.BRIGHT), ("", ST.NORMAL), ("", ST.RESET_ALL), - ("", ST.RESET_ALL), + ("", FG.MAGENTA), ("
", FG.BLUE), ("