"This is the user name used to access salome cvs base.\n")
user_cfg.USER.addMapping('svn_user', config.VARS.user,
"This is the user name used to access salome svn base.\n")
- user_cfg.USER.addMapping('output_level', 3,
- "This is the default output_level you want."
+ user_cfg.USER.addMapping('output_verbose_level', 3,
+ "This is the default output_verbose_level you want."
" 0=>no output, 5=>debug.\n")
user_cfg.USER.addMapping('publish_dir',
os.path.join(os.path.expanduser('~'),
# Check the existence and apply the patch
if os.path.isfile(patch):
- #patch_exe = "patch" # old patch command (now replace by patch.py)
+ #patch_exe = "patch" # old patch command (now replace by patching.py)
patch_exe = os.path.join(config.VARS.srcDir, "patching.py")
patch_cmd = "python %s -p1 -- < %s" % (patch_exe, patch)
+ # Write the command in the terminal if verbose level is at 5
logger.write((" >%s\n" % patch_cmd),5)
+ # Write the command in the log file (can be seen using 'sat log')
logger.logTxtFile.write("\n >%s\n" % patch_cmd)
logger.logTxtFile.flush()
+
+ # Call the command
res_cmd = (subprocess.call(patch_cmd,
shell=True,
cwd=product_info.source_dir,
message = src.printcolors.printcWarning(
_("Failed to apply patch %s") % patch)
- if config.USER.output_level >= 3:
+ if config.USER.output_verbose_level >= 3:
retcode.append(" %s" % message)
else:
retcode.append("%s: %s" % (product_info.name, message))
runner.cfg.APPLICATION.out_dir, 2)
logger.write("\n", 2, False)
- # Get the products list with products informations reagrding the options
+ # Get the products list with products informations regarding the options
products_infos = prepare.get_products_list(options, runner.cfg, logger)
# Get the maximum name length in order to format the terminal display
logger.write('%s: ' % src.printcolors.printcLabel(product_name), 3)
logger.write(' ' * (max_product_name_len - len(product_name)), 3, False)
logger.write("\n", 4, False)
+ # Apply the patch
return_code, patch_res = apply_patch(runner.cfg, product_info, logger)
logger.write(patch_res, 1, False)
if return_code:
_("overwrites a configuration parameters."))
parser.add_option('g', 'debug', 'boolean', 'debug_mode',
_("run salomeTools in debug mode."))
-parser.add_option('l', 'level', 'int', "output_level",
- _("change output level (default is 3)."))
-parser.add_option('s', 'silent', 'boolean', 'silent',
- _("do not write log or show errors."))
+parser.add_option('v', 'verbose', 'int', "output_verbose_level",
+ _("change output verbose level (default is 3)."))
class Sat(object):
'''The main class that stores all the commands of salomeTools
command=__nameCmd__)
# set output level
- if self.options.output_level:
- self.cfg.USER.output_level = self.options.output_level
- if self.cfg.USER.output_level < 1:
- self.cfg.USER.output_level = 1
-
+ if self.options.output_verbose_level is not None:
+ self.cfg.USER.output_verbose_level = self.options.output_verbose_level
+ if self.cfg.USER.output_verbose_level < 1:
+ self.cfg.USER.output_verbose_level = 0
+ silent = (self.cfg.USER.output_verbose_level == 0)
+
# create log file, unless the command is called
# with a logger as parameter
logger_command = src.logger.Logger(self.cfg,
- silent_sysstd=self.options.silent)
+ silent_sysstd=silent)
if logger:
logger_command = logger
printcolors.cleancolor(message))
# get user or option output level
- current_output_level = self.config.USER.output_level
+ current_output_verbose_level = self.config.USER.output_verbose_level
if not ('isatty' in dir(sys.stdout) and sys.stdout.isatty()):
# clean the message color if the terminal is redirected by user
# ex: sat compile appli > log.txt
# Print message regarding the output level value
if level:
- if level <= current_output_level and not self.silentSysStd:
+ if level <= current_output_verbose_level and not self.silentSysStd:
sys.stdout.write(message)
else:
- if self.default_level <= current_output_level and not self.silentSysStd:
+ if self.default_level <= current_output_verbose_level and not self.silentSysStd:
sys.stdout.write(message)
def error(self, message):