From: Christian Van Wambeke Date: Thu, 22 Mar 2018 09:49:18 +0000 (+0100) Subject: fix #10569 X-Git-Tag: 5.1.0~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=511c5cd4b382112509eddf6e606bfcd34ddff82a;p=tools%2Fsat.git fix #10569 --- diff --git a/commands/clean.py b/commands/clean.py index 07239bc..805fa9a 100644 --- a/commands/clean.py +++ b/commands/clean.py @@ -226,11 +226,10 @@ def run(args, runner, logger): if len(l_dir_to_suppress) == 0: logger.write(src.printcolors.printcWarning(_("Nothing to suppress\n"))) - sat_command = (runner.cfg.VARS.salometoolsway + - runner.cfg.VARS.sep + - "sat -h clean") - logger.write(_("Please specify what you want to suppress: " - "tap \"%s\"\n" % sat_command)) + logger.write(_("""\ +Please specify what you want to suppress: +try 'sat --help clean' and 'sat clean ... --products ... --sources --build --install +""")) return # Check with the user if he really wants to suppress the directories @@ -245,4 +244,4 @@ def run(args, runner, logger): # Suppress the list of paths suppress_directories(l_dir_to_suppress, logger) - return 0 \ No newline at end of file + return 0 diff --git a/commands/prepare.py b/commands/prepare.py index bdacf4f..ddd0de3 100644 --- a/commands/prepare.py +++ b/commands/prepare.py @@ -20,6 +20,7 @@ import re import os import src +import src.debug as DBG # Define all possible option for prepare command : sat prepare parser = src.options.Options() @@ -72,14 +73,23 @@ def remove_products(arguments, l_products_info, logger): :return: The updated arguments. :rtype: str ''' - args = arguments - for i, (product_name, __) in enumerate(l_products_info): - args = args.replace(',' + product_name, '') - end_text = ', ' - if i+1 == len(l_products_info): - end_text = '\n' - logger.write(product_name + end_text, 1) - return args + args = str(arguments) #copy of "--products ,XDATA,TESSCODE,cmake" for example + largs = args.split(',') + DBG.write("largs", largs) + toRemove = [name for name,_ in l_products_info] + DBG.write("remove_products", toRemove) + removed = [] + notRemoved = [] + for name in largs[1:]: # skip largs[0] as "--products " + if name in toRemove: + removed.append(name) + else: + notRemoved.append(name) + # DBG.write(removed, removed, True) + logger.write(" %s\n" % ",".join(removed), 1) + DBG.write("notRemoved", notRemoved) + res = largs[0] + ",".join(notRemoved) + return res def find_products_already_getted(l_products): '''function that returns the list of products that have an existing source @@ -149,9 +159,10 @@ def run(args, runner, logger): if not options.force and len(ldev_products) > 0: l_products_not_getted = find_products_already_getted(ldev_products) if len(l_products_not_getted) > 0: - msg = _("Do not get the source of the following products " - "in development mode\nUse the --force option to" - " overwrite it.\n") + msg = _("""\ +Do not get the source of the following products in development mode +Use the --force option to overwrite it. +""") logger.write(src.printcolors.printcWarning(msg), 1) args_product_opt_clean = remove_products(args_product_opt_clean, l_products_not_getted, @@ -163,9 +174,10 @@ def run(args, runner, logger): if not options.force_patch and len(ldev_products) > 0: l_products_with_patchs = find_products_with_patchs(ldev_products) if len(l_products_with_patchs) > 0: - msg = _("do not patch the following products " - "in development mode\nUse the --force_patch option to" - " overwrite it.\n") + msg = _("""\ +do not patch the following products in development mode +Use the --force_patch option to overwrite it. +""") logger.write(src.printcolors.printcWarning(msg), 1) args_product_opt_patch = remove_products(args_product_opt_patch, l_products_with_patchs, @@ -220,4 +232,4 @@ def run(args, runner, logger): else: logger.write('%s\n' % src.printcolors.printc(src.KO_STATUS), 5) - return res_clean + res_source + res_patch \ No newline at end of file + return res_clean + res_source + res_patch diff --git a/src/product.py b/src/product.py index a7acab6..3591f25 100644 --- a/src/product.py +++ b/src/product.py @@ -233,20 +233,23 @@ Please provide a 'compil_script' key in its definition.""") % product_name # Get the full paths of all the patches if product_has_patches(prod_info): patches = [] - for patch in prod_info.patches: - patch_path = patch - # If only a filename, then search for the patch in the PRODUCTPATH - if os.path.basename(patch_path) == patch_path: - # Search in the PRODUCTPATH/patches - patch_path = src.find_file_in_lpath(patch, - config.PATHS.PRODUCTPATH, - "patches") - if not patch_path: - msg = _("Patch %(patch_name)s for %(prod_name)s not found:" - "\n" % {"patch_name" : patch, - "prod_name" : prod_info.name}) - raise src.SatException(msg) - patches.append(patch_path) + try: + for patch in prod_info.patches: + patch_path = patch + # If only a filename, then search for the patch in the PRODUCTPATH + if os.path.basename(patch_path) == patch_path: + # Search in the PRODUCTPATH/patches + patch_path = src.find_file_in_lpath(patch, + config.PATHS.PRODUCTPATH, + "patches") + if not patch_path: + msg = _("Patch %(patch_name)s for %(prod_name)s not found:" + "\n" % {"patch_name" : patch, + "prod_name" : prod_info.name}) + raise src.SatException(msg) + patches.append(patch_path) + except: + DBG.tofix("problem in prod_info.patches", prod_info) prod_info.patches = patches # Get the full paths of the environment scripts @@ -621,7 +624,10 @@ def product_is_dev(product_info): :rtype: boolean ''' dev = product_info.dev - return dev.lower() == 'yes' + res = (dev.lower() == 'yes') + DBG.write('product_is_dev %s' % product_info.name, res) + # if product_info.name == "XDATA": return True #test #10569 + return res def product_is_debug(product_info): '''Know if a product is in debug mode @@ -734,8 +740,11 @@ def product_has_patches(product_info): the product :return: True if the product has one or more patches :rtype: boolean - ''' - return "patches" in product_info and len(product_info.patches) > 0 + ''' + res = ( "patches" in product_info and len(product_info.patches) > 0 ) + DBG.write('product_has_patches %s' % product_info.name, res) + # if product_info.name == "XDATA": return True #test #10569 + return res def product_has_logo(product_info): '''Know if a product has a logo (YACSGEN generate)