From 713d5abd2d3bb247d0175df72ada29cfaa3129de Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Mon, 14 Mar 2016 15:26:22 +0100 Subject: [PATCH] Change 'modules' key word to 'products' and improve prepare command --- commands/config.py | 20 +- commands/patch.py | 60 ++-- commands/prepare.py | 127 +++++--- commands/source.py | 252 +++++++-------- data/{modules => products}/KERNEL.pyconf | 4 +- .../MODULE_ARCHIVE.pyconf | 4 +- data/{modules => products}/MODULE_CVS.pyconf | 6 +- .../MODULE_DEFAULTVERSION.pyconf | 4 +- data/{modules => products}/MODULE_DIR.pyconf | 4 +- .../{modules => products}/MODULE_FIXED.pyconf | 2 +- .../MODULE_NATIVE.pyconf | 4 +- data/{modules => products}/MODULE_SVN.pyconf | 4 +- data/{modules => products}/softA.pyconf | 4 +- data/{modules => products}/softB.pyconf | 4 +- src/__init__.py | 2 +- src/internal_config/salomeTools.pyconf | 2 +- src/module.py | 125 -------- src/product.py | 125 ++++++++ src/system.py | 10 +- test/config/create_user_pyconf.py | 8 +- test/log/launch_browser.py | 1 + test/prepare/res.html | 298 ------------------ test/run_all.sh | 2 +- 23 files changed, 401 insertions(+), 671 deletions(-) rename data/{modules => products}/KERNEL.pyconf (93%) rename data/{modules => products}/MODULE_ARCHIVE.pyconf (94%) rename data/{modules => products}/MODULE_CVS.pyconf (89%) rename data/{modules => products}/MODULE_DEFAULTVERSION.pyconf (94%) rename data/{modules => products}/MODULE_DIR.pyconf (94%) rename data/{modules => products}/MODULE_FIXED.pyconf (93%) rename data/{modules => products}/MODULE_NATIVE.pyconf (94%) rename data/{modules => products}/MODULE_SVN.pyconf (94%) rename data/{modules => products}/softA.pyconf (87%) rename data/{modules => products}/softB.pyconf (87%) delete mode 100644 src/module.py create mode 100644 src/product.py delete mode 100644 test/prepare/res.html diff --git a/commands/config.py b/commands/config.py index 5071b81..4c98687 100644 --- a/commands/config.py +++ b/commands/config.py @@ -276,31 +276,31 @@ class ConfigManager: exec('cfg.' + rule) # ===================================================================== - # Load modules config files in MODULES section + # Load product config files in PRODUCTS section # The directory containing the softwares definition - modules_dir = os.path.join(cfg.VARS.dataDir, 'modules') + products_dir = os.path.join(cfg.VARS.dataDir, 'products') # Loop on all files that are in softsDir directory # and read their config - for fName in os.listdir(modules_dir): + for fName in os.listdir(products_dir): if fName.endswith(".pyconf"): - src.pyconf.streamOpener = ConfigOpener([modules_dir]) + src.pyconf.streamOpener = ConfigOpener([products_dir]) try: - mod_cfg = src.pyconf.Config(open( - os.path.join(modules_dir, fName))) + prod_cfg = src.pyconf.Config(open( + os.path.join(products_dir, fName))) except src.pyconf.ConfigError as e: raise src.SatException(_( - "Error in configuration file: %(soft)s\n %(error)s") % \ - {'soft' : fName, 'error': str(e) }) + "Error in configuration file: %(prod)s\n %(error)s") % \ + {'prod' : fName, 'error': str(e) }) except IOError as error: e = str(error) raise src.SatException( e ); - merger.merge(cfg.MODULES, mod_cfg) + merger.merge(cfg.PRODUCTS, prod_cfg) # apply overwrite from command line if needed - for rule in self.get_command_line_overrides(options, ["MODULES"]): + for rule in self.get_command_line_overrides(options, ["PRODUCTS"]): exec('cfg.' + rule) # this cannot be factorized because of the exec diff --git a/commands/patch.py b/commands/patch.py index 721ed1b..fb97f0c 100644 --- a/commands/patch.py +++ b/commands/patch.py @@ -24,39 +24,39 @@ import prepare # Define all possible option for log command : sat log parser = src.options.Options() -parser.add_option('m', 'module', 'list2', 'modules', - _('modules to get the sources. This option can be' - ' passed several time to get the sources of several modules.')) +parser.add_option('p', 'product', 'list2', 'products', + _('products to get the sources. This option can be' + ' passed several time to get the sources of several products.')) parser.add_option('', 'no_sample', 'boolean', 'no_sample', - _("do not get sources from sample modules.")) + _("do not get sources from sample products.")) -def apply_patch(config, module_info, logger): - '''The method called to apply patches on a module +def apply_patch(config, product_info, logger): + '''The method called to apply patches on a product :param config Config: The global configuration - :param module_info Config: The configuration specific to - the module to be prepared + :param product_info Config: The configuration specific to + the product to be patched :param logger Logger: The logger instance to use for the display and logging :return: (True if it succeed, else False, message to display) :rtype: (boolean, str) ''' - if not "patches" in module_info or len(module_info.patches) == 0: - msg = _("No patch for the %s module") % module_info.name + if not "patches" in product_info or len(product_info.patches) == 0: + msg = _("No patch for the %s product") % product_info.name logger.write(msg, 3) logger.write("\n", 1) return True, "" - if not os.path.exists(module_info.source_dir): - msg = _("No sources found for the %s module\n") % module_info.name + if not os.path.exists(product_info.source_dir): + msg = _("No sources found for the %s product\n") % product_info.name logger.write(src.printcolors.printcWarning(msg), 1) return False, "" # At this point, there one or more patches and the source directory exists retcode = [] res = [] - # Loop on all the patches of the module - for patch in module_info.patches: + # Loop on all the patches of the product + for patch in product_info.patches: details = [] # Check the existence and apply the patch @@ -68,7 +68,7 @@ def apply_patch(config, module_info, logger): logger.write((" >%s\n" % patch_cmd),5) res_cmd = (subprocess.call(patch_cmd, shell=True, - cwd=module_info.source_dir, + cwd=product_info.source_dir, stdout=logger.logTxtFile, stderr=subprocess.STDOUT) == 0) else: @@ -88,7 +88,7 @@ def apply_patch(config, module_info, logger): if config.USER.output_level >= 3: retcode.append(" %s" % message) else: - retcode.append("%s: %s" % (module_info.name, message)) + retcode.append("%s: %s" % (product_info.name, message)) if len(details) > 0: retcode.extend(details) @@ -104,7 +104,7 @@ def description(): :rtype: str ''' return _("The patch command apply the patches on the sources of " - "the application modules if there is any") + "the application products if there is any") def run(args, runner, logger): '''method that is called when salomeTools is called with patch parameter. @@ -123,22 +123,22 @@ def run(args, runner, logger): runner.cfg.APPLICATION.out_dir, 2) logger.write("\n", 2, False) - # Get the modules list with modules informations reagrding the options - modules_infos = prepare.get_modules_list(options, runner.cfg, logger) + # Get the products list with products informations reagrding the options + products_infos = prepare.get_products_list(options, runner.cfg, logger) # Get the maximum name length in order to format the terminal display - max_module_name_len = 1 - if len(modules_infos) > 0: - max_module_name_len = max(map(lambda l: len(l), modules_infos[0])) + 4 + max_product_name_len = 1 + if len(products_infos) > 0: + max_product_name_len = max(map(lambda l: len(l), products_infos[0])) + 4 - # The loop on all the modules on which to apply the patches + # The loop on all the products on which to apply the patches good_result = 0 - for module_name, module_info in modules_infos: + for product_name, product_info in products_infos: # display and log - logger.write('%s: ' % src.printcolors.printcLabel(module_name), 3) - logger.write(' ' * (max_module_name_len - len(module_name)), 3, False) + 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) - return_code, patch_res = apply_patch(runner.cfg, module_info, logger) + return_code, patch_res = apply_patch(runner.cfg, product_info, logger) logger.write(patch_res, 1, False) if return_code: good_result += 1 @@ -146,16 +146,16 @@ def run(args, runner, logger): # Display the results (how much passed, how much failed, etc...) logger.write("\n", 2, False) - if good_result == len(modules_infos): + if good_result == len(products_infos): status = src.OK_STATUS res_count = "%d / %d" % (good_result, good_result) else: status = src.KO_STATUS - res_count = "%d / %d" % (good_result, len(modules_infos)) + res_count = "%d / %d" % (good_result, len(products_infos)) # write results logger.write("Patching sources of the application:", 1) logger.write(" " + src.printcolors.printc(status), 1, False) logger.write(" (%s)\n" % res_count, 1, False) - return len(modules_infos) - good_result \ No newline at end of file + return len(products_infos) - good_result \ No newline at end of file diff --git a/commands/prepare.py b/commands/prepare.py index 12e39e3..bbd189b 100644 --- a/commands/prepare.py +++ b/commands/prepare.py @@ -20,61 +20,62 @@ import src # Define all possible option for log command : sat log parser = src.options.Options() -parser.add_option('m', 'module', 'list2', 'modules', - _('modules to prepare. This option can be' - ' passed several time to prepare several modules.')) +parser.add_option('p', 'product', 'list2', 'products', + _('products to prepare. This option can be' + ' passed several time to prepare several products.')) parser.add_option('', 'no_sample', 'boolean', 'no_sample', - _("do not prepare sample modules.")) + _("do not prepare sample products.")) parser.add_option('f', 'force', 'boolean', 'force', - _("force to prepare the modules in development mode.")) + _("force to prepare the products in development mode.")) -def get_modules_list(options, cfg, logger): - '''method that gives the module list with their informations from +def get_products_list(options, cfg, logger): + '''method that gives the product list with their informations from configuration regarding the passed options. :param options Options: The Options instance that stores the commands arguments :param config Config: The global configuration :param logger Logger: The logger instance to use for the display and logging - :return: The list of (module name, module_infomrmations). + :return: The list of (product name, product_informations). :rtype: List ''' - # Get the modules to be prepared, regarding the options - if options.modules is None: - # No options, get all modules sources - modules = cfg.APPLICATION.modules + # Get the products to be prepared, regarding the options + if options.products is None: + # No options, get all products sources + products = cfg.APPLICATION.products else: - # if option --modules, check that all modules of the command line + # if option --products, check that all products of the command line # are present in the application. - modules = options.modules - for m in modules: - if m not in cfg.APPLICATION.modules: - raise src.SatException(_("Module %(module)s " + products = options.products + for p in products: + if p not in cfg.APPLICATION.products: + raise src.SatException(_("Product %(product)s " "not defined in application %(application)s") % - { 'module': m, 'application': cfg.VARS.application} ) + { 'product': p, 'application': cfg.VARS.application} ) # Construct the list of tuple containing - # the modules name and their definition - modules_infos = src.module.get_modules_infos(modules, cfg) + # the products name and their definition + products_infos = src.product.get_products_infos(products, cfg) - # if the --no_sample option is invoked, suppress the sample modules from + # if the --no_sample option is invoked, suppress the sample products from # the list if options.no_sample: - lmodules_sample = [m for m in modules_infos if src.module.module_is_sample(m[1])] + lproducts_sample = [p for p in products_infos if src.product.product_is_sample(p[1])] - modules_infos = [m for m in modules_infos if m not in lmodules_sample] + products_infos = [p for p in products_infos if p not in lproducts_sample] - if len(lmodules_sample) > 0: - logger.write(src.printcolors.printcWarning(_("Ignoring the following sample modules:\n")), 1) - for i, module in enumerate(lmodules_sample): + if len(lproducts_sample) > 0: + msg = "Ignoring the following sample products:\n" + logger.write(src.printcolors.printcWarning(_(msg)), 1) + for i, product in enumerate(lproducts_sample): end_text = ', ' - if i+1 == len(lmodules_sample): + if i+1 == len(lproducts_sample): end_text = '\n' - logger.write(module[0] + end_text, 1) + logger.write(product[0] + end_text, 1) - return modules_infos + return products_infos def description(): '''method that is called when salomeTools is called with --help option. @@ -83,7 +84,7 @@ def description(): :rtype: str ''' return _("The prepare command apply the patches on the sources of " - "the application modules if there is any") + "the application products if there is any") def run(args, runner, logger): '''method that is called when salomeTools is called with prepare parameter. @@ -95,47 +96,73 @@ def run(args, runner, logger): # check that the command has been called with an application src.check_config_has_application( runner.cfg ) - modules_infos = get_modules_list(options, runner.cfg, logger) + products_infos = get_products_list(options, runner.cfg, logger) + + ################################## + ## Source command # Construct the option to pass to the source command - args_source = runner.cfg.VARS.application + ' ' + args_appli = runner.cfg.VARS.application + ' ' + + args_product_opt = '--product ' + if options.products: + for p_name in options.products: + args_product_opt += ',' + p_name + else: + for p_name, __ in products_infos: + args_product_opt += ',' + p_name - if options.modules: - args_source += '--module ' + ','.join(options.modules) + if args_product_opt == '--product ': + args_product_opt = '' + args_sample = '' if options.no_sample: - args_source += ' --no_sample' + args_sample = ' --no_sample' + + args_source = args_appli + args_product_opt + args_sample if options.force: args_source += ' --force' # Call the source command that gets the source msg = src.printcolors.printcHeader( - _('Get the sources of the desired modules\n')) + _('Get the sources of the desired products\n')) logger.write(msg) res_source = runner.source(args_source) - # Construct the option to pass to the patch command - args_patch = args_source.replace(' --force', '') - if ("dev_modules" in runner.cfg.APPLICATION and - runner.cfg.APPLICATION.dev_modules is not []): + ################################## + ## Patch command + msg = src.printcolors.printcHeader( + _('\nApply the patches to the sources of the products\n')) + logger.write(msg) + + # Construct the option to pass to the patch command + if ("dev_products" in runner.cfg.APPLICATION and + runner.cfg.APPLICATION.dev_products is not []): - dev_modules = runner.cfg.APPLICATION.dev_modules - ldev_modules = [m for m in modules_infos if m[0] in dev_modules] + dev_products = runner.cfg.APPLICATION.dev_products + ldev_products = [p for p in products_infos if p[0] in dev_products] - if len(ldev_modules) > 0: - msg = _("The patches are not applied on " - "the module in development mode\n") + if len(ldev_products) > 0: + msg = _("Ignoring the following products " + "in development mode\n") + logger.write(src.printcolors.printcWarning(msg), 1) + for i, (product_name, __) in enumerate(ldev_products): + args_product_opt.replace(',' + product_name, '') + end_text = ', ' + if i+1 == len(ldev_products): + end_text = '\n' + + logger.write(product_name + end_text, 1) - logger.write() + msg = _("Use the --force_patch option to apply the patches anyway\n") + logger.write(src.printcolors.printcWarning(msg), 1) - modules_infos = [m for m in modules_infos if m[0] not in ldev_modules] + + args_patch = args_appli + args_product_opt + args_sample # Call the source command that gets the source - msg = src.printcolors.printcHeader( - _('\nApply the patches to the sources of the modules\n')) - logger.write(msg) res_patch = runner.patch(args_patch) return res_source + res_patch \ No newline at end of file diff --git a/commands/source.py b/commands/source.py index 4103f03..be83c0c 100644 --- a/commands/source.py +++ b/commands/source.py @@ -24,20 +24,20 @@ import prepare # Define all possible option for log command : sat log parser = src.options.Options() -parser.add_option('m', 'module', 'list2', 'modules', - _('modules from which to get the sources. This option can be' - ' passed several time to get the sources of several modules.')) +parser.add_option('p', 'product', 'list2', 'products', + _('products from which to get the sources. This option can be' + ' passed several time to get the sources of several products.')) parser.add_option('', 'no_sample', 'boolean', 'no_sample', - _("do not get sources from sample modules.")) + _("do not get sources from sample products.")) parser.add_option('f', 'force', 'boolean', 'force', - _("force to get the sources of the modules in development mode.")) + _("force to get the sources of the products in development mode.")) -def get_sources_for_dev(config, module_info, source_dir, force, logger, pad): - '''The method called if the module is in development mode +def get_source_for_dev(config, product_info, source_dir, force, logger, pad): + '''The method called if the product is in development mode :param config Config: The global configuration - :param module_info Config: The configuration specific to - the module to be prepared + :param product_info Config: The configuration specific to + the product to be prepared :param source_dir Path: The Path instance corresponding to the directory where to put the sources :param force boolean: True if the --force option was invoked @@ -47,13 +47,13 @@ def get_sources_for_dev(config, module_info, source_dir, force, logger, pad): :rtype: boolean ''' retcode = 'N\A' - # if the module source directory does not exist, + # if the product source directory does not exist, # get it in checkout mode, else, do not do anything # unless the force option is invoked - if not os.path.exists(module_info.source_dir) or force: + if not os.path.exists(product_info.source_dir) or force: # Call the function corresponding to get the sources with True checkout - retcode = get_module_sources(config, - module_info, + retcode = get_product_sources(config, + product_info, True, source_dir, force, @@ -61,62 +61,62 @@ def get_sources_for_dev(config, module_info, source_dir, force, logger, pad): pad, checkout=True) logger.write("\n", 3, False) - # +2 because module name is followed by ': ' + # +2 because product name is followed by ': ' logger.write(" " * (pad+2), 3, False) logger.write('dev: %s ... ' % - src.printcolors.printcInfo(module_info.source_dir), 3, False) + src.printcolors.printcInfo(product_info.source_dir), 3, False) logger.flush() return retcode -def get_sources_from_git(module_info, source_dir, logger, pad, is_dev=False): - '''The method called if the module is to be get in git mode +def get_source_from_git(product_info, source_dir, logger, pad, is_dev=False): + '''The method called if the product is to be get in git mode - :param module_info Config: The configuration specific to - the module to be prepared + :param product_info Config: The configuration specific to + the product to be prepared :param source_dir Path: The Path instance corresponding to the directory where to put the sources :param logger Logger: The logger instance to use for the display and logging :param pad int: The gap to apply for the terminal display - :param is_dev boolean: True if the module is in development mode + :param is_dev boolean: True if the product is in development mode :return: True if it succeed, else False :rtype: boolean ''' # The str to display coflag = 'git' - # Get the repository address. (from repo_dev key if the module is + # Get the repository address. (from repo_dev key if the product is # in dev mode. - if is_dev and 'repo_dev' in module_info.git_info: + if is_dev and 'repo_dev' in product_info.git_info: coflag = src.printcolors.printcHighlight(coflag.upper()) - repo_git = module_info.git_info.repo_dev + repo_git = product_info.git_info.repo_dev else: - repo_git = module_info.git_info.repo + repo_git = product_info.git_info.repo # Display informations logger.write('%s:%s' % (coflag, src.printcolors.printcInfo(repo_git)), 3, False) logger.write(' ' * (pad + 50 - len(repo_git)), 3, False) logger.write(' tag:%s' % src.printcolors.printcInfo( - module_info.git_info.tag), + product_info.git_info.tag), 3, False) - logger.write(' %s. ' % ('.' * (10 - len(module_info.git_info.tag))), 3, + logger.write(' %s. ' % ('.' * (10 - len(product_info.git_info.tag))), 3, False) logger.flush() logger.write('\n', 5, False) # Call the system function that do the extraction in git mode retcode = src.system.git_extract(repo_git, - module_info.git_info.tag, + product_info.git_info.tag, source_dir, logger) return retcode -def get_sources_from_archive(module_info, source_dir, logger): - '''The method called if the module is to be get in archive mode +def get_source_from_archive(product_info, source_dir, logger): + '''The method called if the product is to be get in archive mode - :param module_info Config: The configuration specific to - the module to be prepared + :param product_info Config: The configuration specific to + the product to be prepared :param source_dir Path: The Path instance corresponding to the directory where to put the sources :param logger Logger: The logger instance to use for the display and logging @@ -124,36 +124,36 @@ def get_sources_from_archive(module_info, source_dir, logger): :rtype: boolean ''' # check archive exists - if not os.path.exists(module_info.archive_info.archive_name): + if not os.path.exists(product_info.archive_info.archive_name): raise src.SatException(_("Archive not found: '%s'") % - module_info.archive_info.archive_name) + product_info.archive_info.archive_name) logger.write('arc:%s ... ' % - src.printcolors.printcInfo(module_info.archive_info.archive_name), + src.printcolors.printcInfo(product_info.archive_info.archive_name), 3, False) logger.flush() # Call the system function that do the extraction in archive mode retcode, NameExtractedDirectory = src.system.archive_extract( - module_info.archive_info.archive_name, + product_info.archive_info.archive_name, source_dir.dir(), logger) # Rename the source directory if - # it does not match with module_info.source_dir + # it does not match with product_info.source_dir if (NameExtractedDirectory.replace('/', '') != - os.path.basename(module_info.source_dir)): - shutil.move(os.path.join(os.path.dirname(module_info.source_dir), + os.path.basename(product_info.source_dir)): + shutil.move(os.path.join(os.path.dirname(product_info.source_dir), NameExtractedDirectory), - module_info.source_dir) + product_info.source_dir) return retcode -def get_sources_from_cvs(user, module_info, source_dir, checkout, logger, pad): - '''The method called if the module is to be get in cvs mode +def get_source_from_cvs(user, product_info, source_dir, checkout, logger, pad): + '''The method called if the product is to be get in cvs mode :param user str: The user to use in for the cvs command - :param module_info Config: The configuration specific to - the module to be prepared + :param product_info Config: The configuration specific to + the product to be prepared :param source_dir Path: The Path instance corresponding to the directory where to put the sources :param checkout boolean: If True, get the source in checkout mode @@ -163,19 +163,19 @@ def get_sources_from_cvs(user, module_info, source_dir, checkout, logger, pad): :rtype: boolean ''' # Get the protocol to use in the command - if "protocol" in module_info.cvs_info: - protocol = module_info.cvs_info.protocol + if "protocol" in product_info.cvs_info: + protocol = product_info.cvs_info.protocol else: protocol = "pserver" # Construct the line to display - if "protocol" in module_info.cvs_info: + if "protocol" in product_info.cvs_info: cvs_line = "%s:%s@%s:%s" % \ - (protocol, user, module_info.cvs_info.server, - module_info.cvs_info.module_base) + (protocol, user, product_info.cvs_info.server, + product_info.cvs_info.product_base) else: - cvs_line = "%s / %s" % (module_info.cvs_info.server, - module_info.cvs_info.module_base) + cvs_line = "%s / %s" % (product_info.cvs_info.server, + product_info.cvs_info.product_base) coflag = 'cvs' if checkout: coflag = src.printcolors.printcHighlight(coflag.upper()) @@ -185,16 +185,16 @@ def get_sources_from_cvs(user, module_info, source_dir, checkout, logger, pad): False) logger.write(' ' * (pad + 50 - len(cvs_line)), 3, False) logger.write(' src:%s' % - src.printcolors.printcInfo(module_info.cvs_info.source), + src.printcolors.printcInfo(product_info.cvs_info.source), 3, False) - logger.write(' ' * (pad + 1 - len(module_info.cvs_info.source)), 3, False) + logger.write(' ' * (pad + 1 - len(product_info.cvs_info.source)), 3, False) logger.write(' tag:%s' % - src.printcolors.printcInfo(module_info.cvs_info.tag), + src.printcolors.printcInfo(product_info.cvs_info.tag), 3, False) # at least one '.' is visible - logger.write(' %s. ' % ('.' * (10 - len(module_info.cvs_info.tag))), + logger.write(' %s. ' % ('.' * (10 - len(product_info.cvs_info.tag))), 3, False) logger.flush() @@ -202,19 +202,19 @@ def get_sources_from_cvs(user, module_info, source_dir, checkout, logger, pad): # Call the system function that do the extraction in cvs mode retcode = src.system.cvs_extract(protocol, user, - module_info.cvs_info.server, - module_info.cvs_info.module_base, - module_info.cvs_info.tag, - module_info.cvs_info.source, + product_info.cvs_info.server, + product_info.cvs_info.product_base, + product_info.cvs_info.tag, + product_info.cvs_info.source, source_dir, logger, checkout) return retcode -def get_sources_from_svn(user, module_info, source_dir, checkout, logger): - '''The method called if the module is to be get in svn mode +def get_source_from_svn(user, product_info, source_dir, checkout, logger): + '''The method called if the product is to be get in svn mode :param user str: The user to use in for the svn command - :param module_info Config: The configuration specific to - the module to be prepared + :param product_info Config: The configuration specific to + the product to be prepared :param source_dir Path: The Path instance corresponding to the directory where to put the sources :param checkout boolean: If True, get the source in checkout mode @@ -227,34 +227,34 @@ def get_sources_from_svn(user, module_info, source_dir, checkout, logger): logger.write('%s:%s ... ' % (coflag, src.printcolors.printcInfo( - module_info.svn_info.repo)), + product_info.svn_info.repo)), 3, False) logger.flush() logger.write('\n', 5, False) # Call the system function that do the extraction in svn mode retcode = src.system.svn_extract(user, - module_info.svn_info.repo, - module_info.svn_info.tag, + product_info.svn_info.repo, + product_info.svn_info.tag, source_dir, logger, checkout) return retcode -def get_module_sources(config, - module_info, +def get_product_sources(config, + product_info, is_dev, source_dir, force, logger, pad, checkout=False): - '''Get the module sources. + '''Get the product sources. :param config Config: The global configuration - :param module_info Config: The configuration specific to - the module to be prepared - :param is_dev boolean: True if the module is in development mode + :param product_info Config: The configuration specific to + the product to be prepared + :param is_dev boolean: True if the product is in development mode :param source_dir Path: The Path instance corresponding to the directory where to put the sources :param force boolean: True if the --force option was invoked @@ -265,65 +265,65 @@ def get_module_sources(config, :rtype: boolean ''' if not checkout and is_dev: - return get_sources_for_dev(config, - module_info, + return get_source_for_dev(config, + product_info, source_dir, force, logger, pad) - if module_info.get_sources == "git": - return get_sources_from_git(module_info, source_dir, logger, pad, + if product_info.get_source == "git": + return get_source_from_git(product_info, source_dir, logger, pad, is_dev) - if module_info.get_sources == "archive": - return get_sources_from_archive(module_info, source_dir, logger) + if product_info.get_source == "archive": + return get_source_from_archive(product_info, source_dir, logger) - if module_info.get_sources == "cvs": + if product_info.get_source == "cvs": cvs_user = config.USER.cvs_user - return get_sources_from_cvs(cvs_user, - module_info, + return get_source_from_cvs(cvs_user, + product_info, source_dir, checkout, logger, pad) - if module_info.get_sources == "svn": + if product_info.get_source == "svn": svn_user = config.USER.svn_user - return get_sources_from_svn(svn_user, module_info, source_dir, + return get_source_from_svn(svn_user, product_info, source_dir, checkout, logger) - if module_info.get_sources == "native": + if product_info.get_source == "native": # skip logger.write('%s ...' % _("native (ignored)"), 3, False) return True - if module_info.get_sources == "fixed": + if product_info.get_source == "fixed": # skip logger.write('%s ...' % _("fixed (ignored)"), 3, False) return True - if len(module_info.get_sources) == 0: + if len(product_info.get_source) == 0: # skip logger.write('%s ...' % _("ignored"), 3, False) return True - # if the get_sources is not in [git, archive, cvs, svn, dir] - logger.write(_("Unknown get_mehtod %(get)s for module %(module)s") % \ - { 'get': module_info.get_sources, 'module': module_info.name }, 3, False) + # if the get_source is not in [git, archive, cvs, svn, dir] + logger.write(_("Unknown get_mehtod %(get)s for product %(product)s") % \ + { 'get': product_info.get_source, 'product': product_info.name }, 3, False) logger.write(" ... ", 3, False) logger.flush() return False -def get_all_module_sources(config, modules, force, logger): - '''Get all the module sources. +def get_all_product_sources(config, products, force, logger): + '''Get all the product sources. :param config Config: The global configuration - :param modules List: The list of tuples (module name, module informations) + :param products List: The list of tuples (product name, product informations) :param force boolean: True if the --force option was invoked :param logger Logger: The logger instance to be used for the logging - :return: the tuple (number of success, dictionary module_name/success_fail) + :return: the tuple (number of success, dictionary product_name/success_fail) :rtype: (int,dict) ''' @@ -332,53 +332,53 @@ def get_all_module_sources(config, modules, force, logger): good_result = 0 # Get the maximum name length in order to format the terminal display - max_module_name_len = 1 - if len(modules) > 0: - max_module_name_len = max(map(lambda l: len(l), modules[0])) + 4 + max_product_name_len = 1 + if len(products) > 0: + max_product_name_len = max(map(lambda l: len(l), products[0])) + 4 - # The loop on all the modules from which to get the sources - for module_name, module_info in modules: - # get module name, module informations and the directory where to put + # The loop on all the products from which to get the sources + for product_name, product_info in products: + # get product name, product informations and the directory where to put # the sources - if not src.module.module_is_fixed(module_info): - source_dir = src.Path(module_info.source_dir) + if not src.product.product_is_fixed(product_info): + source_dir = src.Path(product_info.source_dir) else: source_dir = src.Path('') # display and log - logger.write('%s: ' % src.printcolors.printcLabel(module_name), 3) - logger.write(' ' * (max_module_name_len - len(module_name)), 3, False) + 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) # Remove the existing source directory if - # the module is not in development mode - is_dev = ("dev_modules" in config.APPLICATION and - module_name in config.APPLICATION.dev_modules) + # the product is not in development mode + is_dev = ("dev_products" in config.APPLICATION and + product_name in config.APPLICATION.dev_products) if source_dir.exists() and not is_dev: logger.write(" " + _('remove %s') % source_dir, 4) logger.write("\n ", 4, False) source_dir.rm() - # Call to the function that get the sources for one module - retcode = get_module_sources(config, - module_info, + # Call to the function that get the sources for one product + retcode = get_product_sources(config, + product_info, is_dev, source_dir, force, logger, - max_module_name_len, + max_product_name_len, checkout=False) ''' - if 'no_rpath' in module_info.keys(): - if module_info.no_rpath: - hack_no_rpath(config, module_info, logger) + if 'no_rpath' in product_info.keys(): + if product_info.no_rpath: + hack_no_rpath(config, product_info, logger) ''' # show results - results[module_name] = retcode + results[product_name] = retcode if retcode == 'N\A': - # The case where the module was not prepared because it is + # The case where the product was not prepared because it is # in development mode res =(src.printcolors.printc(src.OK_STATUS) + src.printcolors.printcWarning(_( @@ -403,7 +403,7 @@ def description(): :return: The text to display for the source command description. :rtype: str ''' - return _("The source command gets the sources of the application modules " + return _("The source command gets the sources of the application products " "from cvs, git, an archive or a directory..") def run(args, runner, logger): @@ -426,15 +426,15 @@ def run(args, runner, logger): force = options.force if force: msg = _("Warning: the --force option has effect only " - "on modules in development mode\n\n") + "on products in development mode\n\n") logger.write(src.printcolors.printcWarning(msg)) - # Get the modules list with modules informations reagrding the options - modules_infos = prepare.get_modules_list(options, runner.cfg, logger) + # Get the products list with products informations regarding the options + products_infos = prepare.get_products_list(options, runner.cfg, logger) # Call to the function that gets all the sources - good_result, results = get_all_module_sources(runner.cfg, - modules_infos, + good_result, results = get_all_product_sources(runner.cfg, + products_infos, force, logger) @@ -443,17 +443,17 @@ def run(args, runner, logger): details = [] logger.write("\n", 2, False) - if good_result == len(modules_infos): + if good_result == len(products_infos): res_count = "%d / %d" % (good_result, good_result) else: status = src.KO_STATUS - res_count = "%d / %d" % (good_result, len(modules)) + res_count = "%d / %d" % (good_result, len(products_infos)) - for module in results: - if results[module] == 0 or results[module] is None: - details.append(module) + for product in results: + if results[product] == 0 or results[product] is None: + details.append(product) - result = len(modules_infos) - good_result + result = len(products_infos) - good_result # write results logger.write(_("Getting sources of the application:"), 1) diff --git a/data/modules/KERNEL.pyconf b/data/products/KERNEL.pyconf similarity index 93% rename from data/modules/KERNEL.pyconf rename to data/products/KERNEL.pyconf index 06396f4..7bb456e 100644 --- a/data/modules/KERNEL.pyconf +++ b/data/products/KERNEL.pyconf @@ -1,8 +1,8 @@ KERNEL_V7_7_1 : { name : "KERNEL" - build_sources : "cmake" - get_sources : "git" + build_source : "cmake" + get_source : "git" git_info: { repo : "http://git.salome-platform.org/gitpub/modules/kernel.git" diff --git a/data/modules/MODULE_ARCHIVE.pyconf b/data/products/MODULE_ARCHIVE.pyconf similarity index 94% rename from data/modules/MODULE_ARCHIVE.pyconf rename to data/products/MODULE_ARCHIVE.pyconf index 5e59cee..64a9a14 100644 --- a/data/modules/MODULE_ARCHIVE.pyconf +++ b/data/products/MODULE_ARCHIVE.pyconf @@ -1,8 +1,8 @@ MODULE_ARCHIVE : { name : "MODULE_ARCHIVE" - compile_method : "cmake" - get_sources : "archive" + build_source : "cmake" + get_source : "archive" git_info: { repo : "http://git.salome-platform.org/gitpub/modules/kernel.git" diff --git a/data/modules/MODULE_CVS.pyconf b/data/products/MODULE_CVS.pyconf similarity index 89% rename from data/modules/MODULE_CVS.pyconf rename to data/products/MODULE_CVS.pyconf index 9ce2529..17e956f 100644 --- a/data/modules/MODULE_CVS.pyconf +++ b/data/products/MODULE_CVS.pyconf @@ -1,8 +1,8 @@ MODULE_CVS_V6_7_0 : { name : "MODULE_CVS" - build_sources : "cmake" - get_sources : "cvs" + build_source : "cmake" + get_source : "cvs" git_info: { repo : "http://git.salome-platform.org/gitpub/modules/kernel.git" @@ -15,7 +15,7 @@ MODULE_CVS_V6_7_0 : cvs_info: { server : "cvs.opencascade.com" - module_base : "/home/server/cvs/KERNEL" + product_base : "/home/server/cvs/KERNEL" source : 'KERNEL_SRC' } environ : diff --git a/data/modules/MODULE_DEFAULTVERSION.pyconf b/data/products/MODULE_DEFAULTVERSION.pyconf similarity index 94% rename from data/modules/MODULE_DEFAULTVERSION.pyconf rename to data/products/MODULE_DEFAULTVERSION.pyconf index 561e047..bd0c7e4 100644 --- a/data/modules/MODULE_DEFAULTVERSION.pyconf +++ b/data/products/MODULE_DEFAULTVERSION.pyconf @@ -1,8 +1,8 @@ MODULE_DEFAULTVERSION : { name : "MODULE_DEFAULTVERSION" - build_sources : "cmake" - get_sources : "git" + build_source : "cmake" + get_source : "git" git_info: { repo : "http://git.salome-platform.org/gitpub/modules/kernel.git" diff --git a/data/modules/MODULE_DIR.pyconf b/data/products/MODULE_DIR.pyconf similarity index 94% rename from data/modules/MODULE_DIR.pyconf rename to data/products/MODULE_DIR.pyconf index f51e1e0..7f0763a 100644 --- a/data/modules/MODULE_DIR.pyconf +++ b/data/products/MODULE_DIR.pyconf @@ -1,8 +1,8 @@ MODULE_DIR : { name : "MODULE_DIR" - compile_method : "cmake" - get_sources : "dir" + build_source : "cmake" + get_source : "dir" git_info: { repo : "http://git.salome-platform.org/gitpub/modules/kernel.git" diff --git a/data/modules/MODULE_FIXED.pyconf b/data/products/MODULE_FIXED.pyconf similarity index 93% rename from data/modules/MODULE_FIXED.pyconf rename to data/products/MODULE_FIXED.pyconf index 80d90f3..362fea2 100644 --- a/data/modules/MODULE_FIXED.pyconf +++ b/data/products/MODULE_FIXED.pyconf @@ -1,7 +1,7 @@ MODULE_FIXED : { name : "MODULE_FIXED" - get_sources : "fixed" + get_source : "fixed" environ : { "_LD_LIBRARY_PATH" : "${SOFT_ROOT_DIR}" + $VARS.sep + "lib" diff --git a/data/modules/MODULE_NATIVE.pyconf b/data/products/MODULE_NATIVE.pyconf similarity index 94% rename from data/modules/MODULE_NATIVE.pyconf rename to data/products/MODULE_NATIVE.pyconf index 9d853e1..3de0e1f 100644 --- a/data/modules/MODULE_NATIVE.pyconf +++ b/data/products/MODULE_NATIVE.pyconf @@ -1,8 +1,8 @@ MODULE_NATIVE : { name : "MODULE_NATIVE" - compile_method : "cmake" - get_sources : "native" + build_source : "cmake" + get_source : "native" git_info: { repo : "http://git.salome-platform.org/gitpub/modules/kernel.git" diff --git a/data/modules/MODULE_SVN.pyconf b/data/products/MODULE_SVN.pyconf similarity index 94% rename from data/modules/MODULE_SVN.pyconf rename to data/products/MODULE_SVN.pyconf index a7a45b4..4856e99 100644 --- a/data/modules/MODULE_SVN.pyconf +++ b/data/products/MODULE_SVN.pyconf @@ -1,8 +1,8 @@ MODULE_SVN : { name : "MODULE_SVN" - build_sources : "cmake" - get_sources : "svn" + build_source : "cmake" + get_source : "svn" git_info: { repo : "http://git.salome-platform.org/gitpub/modules/kernel.git" diff --git a/data/modules/softA.pyconf b/data/products/softA.pyconf similarity index 87% rename from data/modules/softA.pyconf rename to data/products/softA.pyconf index f7c0f9b..a48c30d 100644 --- a/data/modules/softA.pyconf +++ b/data/products/softA.pyconf @@ -1,8 +1,8 @@ softA : { name : "softA" - get_sources : "cmake" # ou autotools, ou script - get_method : "git" # "archive", embedded", "native" "fixed" + build_source : "cmake" # ou autotools, ou script + get_source : "git" # "archive", embedded", "native" "fixed" cvs_info: { server : $SITE.prepare.default_cvs_server diff --git a/data/modules/softB.pyconf b/data/products/softB.pyconf similarity index 87% rename from data/modules/softB.pyconf rename to data/products/softB.pyconf index 31e195d..5096e19 100644 --- a/data/modules/softB.pyconf +++ b/data/products/softB.pyconf @@ -1,8 +1,8 @@ softB : { name : "softB" - get_sources : "cmake" # ou autotools, ou script - get_method : "git" # "archive", embedded", "native" "fixed" + build_source : "cmake" # ou autotools, ou script + get_source : "git" # "archive", embedded", "native" "fixed" cvs_info: { server : $SITE.prepare.default_cvs_server diff --git a/src/__init__.py b/src/__init__.py index 5c4980e..237ccc3 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -28,7 +28,7 @@ from . import options from . import system from . import ElementTree from . import logger -from . import module +from . import product OK_STATUS = "OK" KO_STATUS = "KO" diff --git a/src/internal_config/salomeTools.pyconf b/src/internal_config/salomeTools.pyconf index d89f32d..ab1f694 100644 --- a/src/internal_config/salomeTools.pyconf +++ b/src/internal_config/salomeTools.pyconf @@ -9,6 +9,6 @@ INTERNAL : not_shown_commands : ["log"] } } -MODULES : +PRODUCTS : { } diff --git a/src/module.py b/src/module.py deleted file mode 100644 index c2a4b5f..0000000 --- a/src/module.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python -#-*- coding:utf-8 -*- -# Copyright (C) 2010-2012 CEA/DEN -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -'''In this file are implemented the classes and methods - relative to the module notion of salomeTools -''' - -import src - -AVAILABLE_VCS = ['git', 'svn', 'cvs'] - -def get_module_config(config, module_name, version): - '''Get the specific configuration of a module from the global configuration - - :param config Config: The global configuration - :param module_name str: The name of the module - :param version str: The version of the module - :return: the specific configuration of the module - :rtype: Config - ''' - vv = version - # substitute some character with _ - for c in ".-": vv = vv.replace(c, "_") - full_module_name = module_name + '_' + vv - - mod_info = None - # If it exists, get the information of the module_version - if full_module_name in config.MODULES: - # returns specific information for the given version - mod_info = config.MODULES[full_module_name] - # Get the standard informations - elif module_name in config.MODULES: - # returns the generic information (given version not found) - mod_info = config.MODULES[module_name] - - # merge opt_depend in depend - if mod_info is not None and 'opt_depend' in mod_info: - for depend in mod_info.opt_depend: - if depend in config.MODULES: - mod_info.depend.append(depend,'') - - # Check if the module is defined as native in the application - pass # to be done - - # In case of a module get with a vcs, put the tag (equal to the version) - if mod_info is not None and mod_info.get_sources in AVAILABLE_VCS: - - if mod_info.get_sources == 'git': - mod_info.git_info.tag = version - - if mod_info.get_sources == 'svn': - mod_info.svn_info.tag = version - - if mod_info.get_sources == 'cvs': - mod_info.cvs_info.tag = version - - # In case of a fixed module, define the install_dir (equal to the version) - if mod_info is not None and mod_info.get_sources=="fixed": - mod_info.install_dir = version - - return mod_info - -def get_modules_infos(lmodules, config): - '''Get the specific configuration of a list of modules - - :param lmodules List: The list of module names - :param config Config: The global configuration - :return: the list of tuples - (module name, specific configuration of the module) - :rtype: [(str, Config)] - ''' - modules_infos = [] - # Loop on module names - for mod in lmodules: - # Get the version of the module from the application definition - version_mod = config.APPLICATION.modules[mod] - # if no version, then take the default one defined in the application - if isinstance(version_mod, bool): - version_mod = config.APPLICATION.tag - - # Get the specific configuration of the module - mod_info = get_module_config(config, mod, version_mod) - if mod_info is not None: - modules_infos.append((mod, mod_info)) - else: - msg = _("The %s module has no definition in the configuration.") % mod - raise src.SatException(msg) - return modules_infos - - -def module_is_sample(module_info): - '''Know if a module has the sample type - - :param module_info Config: The configuration specific to - the module - :return: True if the module has the sample type, else False - :rtype: boolean - ''' - mtype = module_info.type - return mtype.lower() == 'sample' - -def module_is_fixed(module_info): - '''Know if a module is fixed - - :param module_info Config: The configuration specific to - the module - :return: True if the module is fixed, else False - :rtype: boolean - ''' - get_src = module_info.get_sources - return get_src.lower() == 'fixed' \ No newline at end of file diff --git a/src/product.py b/src/product.py new file mode 100644 index 0000000..7ae8d6d --- /dev/null +++ b/src/product.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- +# Copyright (C) 2010-2012 CEA/DEN +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +'''In this file are implemented the classes and methods + relative to the product notion of salomeTools +''' + +import src + +AVAILABLE_VCS = ['git', 'svn', 'cvs'] + +def get_product_config(config, product_name, version): + '''Get the specific configuration of a product from the global configuration + + :param config Config: The global configuration + :param product_name str: The name of the product + :param version str: The version of the product + :return: the specific configuration of the product + :rtype: Config + ''' + vv = version + # substitute some character with _ + for c in ".-": vv = vv.replace(c, "_") + full_product_name = product_name + '_' + vv + + prod_info = None + # If it exists, get the information of the product_version + if full_product_name in config.PRODUCTS: + # returns specific information for the given version + prod_info = config.PRODUCTS[full_product_name] + # Get the standard informations + elif product_name in config.PRODUCTS: + # returns the generic information (given version not found) + prod_info = config.PRODUCTS[product_name] + + # merge opt_depend in depend + if prod_info is not None and 'opt_depend' in prod_info: + for depend in prod_info.opt_depend: + if depend in config.PRODUCTS: + prod_info.depend.append(depend,'') + + # Check if the product is defined as native in the application + pass # to be done + + # In case of a product get with a vcs, put the tag (equal to the version) + if prod_info is not None and prod_info.get_source in AVAILABLE_VCS: + + if prod_info.get_source == 'git': + prod_info.git_info.tag = version + + if prod_info.get_source == 'svn': + prod_info.svn_info.tag = version + + if prod_info.get_source == 'cvs': + prod_info.cvs_info.tag = version + + # In case of a fixed product, define the install_dir (equal to the version) + if prod_info is not None and prod_info.get_source=="fixed": + prod_info.install_dir = version + + return prod_info + +def get_products_infos(lproducts, config): + '''Get the specific configuration of a list of products + + :param lproducts List: The list of product names + :param config Config: The global configuration + :return: the list of tuples + (product name, specific configuration of the product) + :rtype: [(str, Config)] + ''' + products_infos = [] + # Loop on product names + for prod in lproducts: + # Get the version of the product from the application definition + version_prod = config.APPLICATION.products[prod] + # if no version, then take the default one defined in the application + if isinstance(version_prod, bool): + version_prod = config.APPLICATION.tag + + # Get the specific configuration of the product + prod_info = get_product_config(config, prod, version_prod) + if prod_info is not None: + products_infos.append((prod, prod_info)) + else: + msg = _("The %s product has no definition in the configuration.") % prod + raise src.SatException(msg) + return products_infos + + +def product_is_sample(product_info): + '''Know if a product has the sample type + + :param product_info Config: The configuration specific to + the product + :return: True if the product has the sample type, else False + :rtype: boolean + ''' + mtype = product_info.type + return mtype.lower() == 'sample' + +def product_is_fixed(product_info): + '''Know if a product is fixed + + :param product_info Config: The configuration specific to + the product + :return: True if the product is fixed, else False + :rtype: boolean + ''' + get_src = product_info.get_source + return get_src.lower() == 'fixed' \ No newline at end of file diff --git a/src/system.py b/src/system.py index 7761cef..c0d5178 100644 --- a/src/system.py +++ b/src/system.py @@ -82,7 +82,7 @@ def archive_extract(from_what, where, logger): logger.write("archive_extract: %s\n" % exc) return False, None -def cvs_extract(protocol, user, server, base, tag, module, where, +def cvs_extract(protocol, user, server, base, tag, product, where, logger, checkout=False): opttag = '' @@ -97,13 +97,13 @@ def cvs_extract(protocol, user, server, base, tag, module, where, if len(protocol) > 0: root = "%s@%s:%s" % (user, server, base) - command = "cvs -d :%(protocol)s:%(root)s %(command)s -d %(where)s %(tag)s %(module)s" % \ + command = "cvs -d :%(protocol)s:%(root)s %(command)s -d %(where)s %(tag)s %(product)s" % \ { 'protocol': protocol, 'root': root, 'where': str(where.base()), - 'tag': opttag, 'module': module, 'command': cmd } + 'tag': opttag, 'product': product, 'command': cmd } else: - command = "cvs -d %(root)s %(command)s -d %(where)s %(tag)s %(base)s/%(module)s" % \ + command = "cvs -d %(root)s %(command)s -d %(where)s %(tag)s %(base)s/%(product)s" % \ { 'root': server, 'base': base, 'where': str(where.base()), - 'tag': opttag, 'module': module, 'command': cmd } + 'tag': opttag, 'product': product, 'command': cmd } logger.logTxtFile.write(command + "\n") logger.write(command + "\n", 5) diff --git a/test/config/create_user_pyconf.py b/test/config/create_user_pyconf.py index f59f450..bae7ef8 100644 --- a/test/config/create_user_pyconf.py +++ b/test/config/create_user_pyconf.py @@ -119,16 +119,16 @@ class TestConfig(unittest.TestCase): # pyunit method to compare 2 str self.assertEqual(OK, "OK") - def test_override_MODULES(self): - '''override MODULES + def test_override_PRODUCTS(self): + '''override PRODUCTS ''' OK = "KO" # The command to test - sat = Sat("-oMODULES.softA.compile_method='test'") + sat = Sat("-oPRODUCTS.softA.name='test'") sat.config('') - if sat.cfg.MODULES.softA.compile_method == 'test': + if sat.cfg.PRODUCTS.softA.name == 'test': OK = "OK" # pyunit method to compare 2 str diff --git a/test/log/launch_browser.py b/test/log/launch_browser.py index 2eb9698..c0cf72c 100644 --- a/test/log/launch_browser.py +++ b/test/log/launch_browser.py @@ -330,6 +330,7 @@ class TestLog(unittest.TestCase): sat = Sat("-oUSER.browser='konqueror'") time.sleep(sleep_time) + time.sleep(5) cmd_log = threading.Thread(target=sat.log, args=('--full',)) cmd_log.start() diff --git a/test/prepare/res.html b/test/prepare/res.html deleted file mode 100644 index 42ebed3..0000000 --- a/test/prepare/res.html +++ /dev/null @@ -1,298 +0,0 @@ - - - - - Unit Test Report - - - - - - - - - -
-

Unit Test Report

-

Start Time: 2016-03-11 15:04:07

-

Duration: 0:01:32.373196

-

Status: Pass 1

- -

-
- - - -

Show -Summary -Failed -All -

- -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Test Group/Test caseCountPassFailErrorView
TestLog: Test of log command: launch of browser1100Detail
test_prepare_all: Test the prepare command with many ways to prepare
- - - - pass - - - - -
Total1100 
- -
 
- - - diff --git a/test/run_all.sh b/test/run_all.sh index bf13d1f..3de7995 100755 --- a/test/run_all.sh +++ b/test/run_all.sh @@ -22,5 +22,5 @@ coverage run --source=../commands/config.py -a config/create_user_pyconf.py >> t coverage run --source=../commands/config.py -a config/option_copy.py >> test_res.html coverage run --source=../commands/config.py -a config/option_edit.py >> test_res.html coverage run --source=../commands/config.py,../commands/log.py,../src/xmlManager.py,../src/logger.py -a log/launch_browser.py >> test_res.html -coverage run --source=../commands/config.py,../commands/source.py,../commands/patch.py,../commands/prepare.py,../src/module.py -a prepare/test_prepare.py >> test_res.html +coverage run --source=../commands/config.py,../commands/source.py,../commands/patch.py,../commands/prepare.py,../src/product.py -a prepare/test_prepare.py >> test_res.html coverage html -- 2.39.2