X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=commands%2Fpatch.py;h=ec438655fd61df9be55ada8452628d251ee8fc97;hb=00a94c7b2e189587897f2fed3d7ee94a1f642800;hp=2d12bbbefc7b29a63f05dba3ee90fc1911c8f826;hpb=39f16786c8fb446a49f6040adabe30298cae5bc9;p=tools%2Fsat.git diff --git a/commands/patch.py b/commands/patch.py index 2d12bbb..ec43865 100644 --- a/commands/patch.py +++ b/commands/patch.py @@ -18,6 +18,7 @@ import os import subprocess +import re import src import prepare @@ -25,8 +26,7 @@ import prepare # Define all possible option for patch command : sat patch parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('products to get the sources. This option can be' - ' passed several time to get the sources of several products.')) + _('Optional: products to get the sources. This option accepts a comma separated list.')) def apply_patch(config, product_info, max_product_name_len, logger): '''The method called to apply patches on a product @@ -39,6 +39,18 @@ def apply_patch(config, product_info, max_product_name_len, logger): :rtype: (boolean, str) ''' + # if the product is native, do not apply patch + if src.product.product_is_native(product_info): + # display and log + logger.write('%s: ' % src.printcolors.printcLabel(product_info.name), 4) + logger.write(' ' * (max_product_name_len - len(product_info.name)), 4, False) + logger.write("\n", 4, False) + msg = _("The %s product is native. Do not apply " + "any patch.") % product_info.name + logger.write(msg, 4) + logger.write("\n", 4) + return True, "" + if not "patches" in product_info or len(product_info.patches) == 0: # display and log logger.write('%s: ' % src.printcolors.printcLabel(product_info.name), 4) @@ -68,10 +80,8 @@ def apply_patch(config, product_info, max_product_name_len, logger): # Check the existence and apply the patch if os.path.isfile(patch): - #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) - + patch_cmd = "patch -p1 < %s" % patch + # Write the command in the terminal if verbose level is at 5 logger.write((" >%s\n" % patch_cmd),5) @@ -118,7 +128,8 @@ def description(): :rtype: str ''' return _("The patch command apply the patches on the sources of " - "the application products if there is any") + "the application products if there is any.\n\nexample:\nsat " + "patch SALOME-master --products qt,boost") def run(args, runner, logger): '''method that is called when salomeTools is called with patch parameter. @@ -138,7 +149,7 @@ def run(args, runner, logger): logger.write("\n", 2, False) # Get the products list with products informations regarding the options - products_infos = prepare.get_products_list(options, runner.cfg, logger) + products_infos = src.product.get_products_list(options, runner.cfg, logger) # Get the maximum name length in order to format the terminal display max_product_name_len = 1 @@ -172,4 +183,4 @@ def run(args, runner, logger): logger.write(" " + src.printcolors.printc(status), 1, False) logger.write(" (%s)\n" % res_count, 1, False) - return len(products_infos) - good_result \ No newline at end of file + return len(products_infos) - good_result