From: crouzet Date: Wed, 25 Oct 2017 14:18:36 +0000 (+0200) Subject: ajout d'un répertoire local ARCHIVES pour le stockage des archives - modification... X-Git-Tag: 5.0.0b2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fa2131df807fd5d328bca51e89f1e683f75a9b20;p=tools%2Fsat.git ajout d'un répertoire local ARCHIVES pour le stockage des archives - modification unknown à default --- diff --git a/commands/config.py b/commands/config.py index 084df54..5d48be5 100644 --- a/commands/config.py +++ b/commands/config.py @@ -263,22 +263,28 @@ class ConfigManager: raise src.SatException( e ); merger.merge(cfg, local_cfg) - # When the key is "unknown", put the default value - if cfg.LOCAL.base == "unknown": + # When the key is "default", put the default value + if cfg.LOCAL.base == "default": cfg.LOCAL.base = os.path.abspath( os.path.join(cfg.VARS.salometoolsway, "..", "BASE")) - if cfg.LOCAL.workdir == "unknown": + if cfg.LOCAL.workdir == "default": cfg.LOCAL.workdir = os.path.abspath( os.path.join(cfg.VARS.salometoolsway, "..")) - if cfg.LOCAL.log_dir == "unknown": + if cfg.LOCAL.log_dir == "default": cfg.LOCAL.log_dir = os.path.abspath( os.path.join(cfg.VARS.salometoolsway, "..", "LOGS")) + if cfg.LOCAL.archive_dir == "default": + cfg.LOCAL.archive_dir = os.path.abspath( + os.path.join(cfg.VARS.salometoolsway, + "..", + "ARCHIVES")) + # apply overwrite from command line if needed for rule in self.get_command_line_overrides(options, ["LOCAL"]): exec('cfg.' + rule) # this cannot be factorized because of the exec @@ -340,6 +346,10 @@ class ConfigManager: cfg.PATHS.JOBPATH.append(cfg.VARS.personal_jobs_dir, "") cfg.PATHS["MACHINEPATH"] = src.pyconf.Sequence(cfg.PATHS) cfg.PATHS.MACHINEPATH.append(cfg.VARS.personal_machines_dir, "") + + # initialise the path with local directory + cfg.PATHS["ARCHIVEPATH"].append(cfg.LOCAL.archive_dir, "") + # Loop over the projects in order to complete the PATHS variables for project in cfg.PROJECTS.projects: for PATH in ["APPLICATIONPATH", @@ -516,14 +526,15 @@ class ConfigManager: 'evince', "This is the pdf_viewer used " "to read pdf documentation\n") - user_cfg.USER.addMapping("base", - src.pyconf.Reference( - user_cfg, - src.pyconf.DOLLAR, - 'workdir + $VARS.sep + "BASE"'), - "The products installation base (could be " - "ignored if this key exists in the local.pyconf" - " file of salomTools).\n") +# CNC 25/10/17 : plus nécessaire a priori +# user_cfg.USER.addMapping("base", +# src.pyconf.Reference( +# user_cfg, +# src.pyconf.DOLLAR, +# 'workdir + $VARS.sep + "BASE"'), +# "The products installation base (could be " +# "ignored if this key exists in the local.pyconf" +# " file of salomTools).\n") # src.ensure_path_exists(config.VARS.personalDir) diff --git a/commands/init.py b/commands/init.py index 0a0103a..0332557 100644 --- a/commands/init.py +++ b/commands/init.py @@ -27,6 +27,9 @@ parser.add_option('b', 'base', 'string', 'base', parser.add_option('w', 'workdir', 'string', 'workdir', _('Optional: The path to the working directory ' '(where to install the applications')) +parser.add_option('a', 'archive_dir', 'string', 'archive_dir', + _('Optional: The path to the local archive directory ' + '(where to install local source archives')) parser.add_option('v', 'VCS', 'string', 'VCS', _('Optional: The address of the repository of SAT ' '(only informative)')) @@ -73,6 +76,7 @@ def display_local_values(config, logger): info = [("base", config.LOCAL.base), ("workdir", config.LOCAL.workdir), ("log_dir", config.LOCAL.log_dir), + ("archive_dir", config.LOCAL.archive_dir), ("VCS", config.LOCAL.VCS), ("tag", config.LOCAL.tag)] src.print_info(logger, info) @@ -85,7 +89,7 @@ def check_path(path_to_check, logger): :param path_to_check Str: The path to check. :param logger Logger: The logger instance. """ - if path_to_check == "unknown": + if path_to_check == "default": return 0 # Get the path @@ -134,7 +138,8 @@ def run(args, runner, logger): # Set the options corresponding to a directory for opt in [("base" , options.base), ("workdir", options.workdir), - ("log_dir", options.log_dir)]: + ("log_dir", options.log_dir), + ("archive_dir", options.archive_dir)]: key, value = opt if value: res_check = check_path(value, logger) @@ -151,4 +156,4 @@ def run(args, runner, logger): display_local_values(runner.cfg, logger) - return res \ No newline at end of file + return res diff --git a/commands/jobs.py b/commands/jobs.py index 42b5c1a..15d33f8 100644 --- a/commands/jobs.py +++ b/commands/jobs.py @@ -825,8 +825,8 @@ class Jobs(object): # the init command (__, out_dist, __) = machine.exec_command( os.path.join(machine.sat_path, - "sat init --base unknown --workdir" - " unknown --log_dir unknown"), + "sat init --base default --workdir" + " default --log_dir default"), self.logger) out_dist.read() diff --git a/commands/package.py b/commands/package.py index 5c2da38..0d8946b 100644 --- a/commands/package.py +++ b/commands/package.py @@ -64,9 +64,10 @@ LOCAL_TEMPLATE = ("""#!/usr/bin/env python LOCAL : { - base : 'unknown' - workdir : 'unknown' - log_dir : 'unknown' + base : 'default' + workdir : 'default' + log_dir : 'default' + archive_dir : 'default' VCS : None tag : None } diff --git a/data/local.pyconf b/data/local.pyconf index baf2b8c..3646f26 100644 --- a/data/local.pyconf +++ b/data/local.pyconf @@ -1,10 +1,11 @@ -#!/usr/bin/env python + #!/usr/bin/env python #-*- coding:utf-8 -*- LOCAL : { - base : 'unknown' - workdir : 'unknown' - log_dir : 'unknown' + base : 'default' + workdir : 'default' + log_dir : 'default' + archive_dir : 'default' VCS : None tag : None }