From 1d77008157d909e80fe6ed9871446542bdbb0af2 Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Thu, 6 Oct 2016 12:07:35 +0200 Subject: [PATCH] Improve help of each command --- commands/application.py | 23 ++++++++++++++--------- commands/base.py | 4 ++-- commands/check.py | 7 +++++-- commands/clean.py | 19 +++++++++++-------- commands/compile.py | 29 +++++++++++++++++------------ commands/config.py | 15 ++++++++------- commands/configure.py | 9 +++++---- commands/environ.py | 13 +++++++------ commands/find_duplicates.py | 13 ++++++++----- commands/generate.py | 7 ++++--- commands/job.py | 13 ++++++++++--- commands/jobs.py | 7 ++++--- commands/launcher.py | 12 +++++++----- commands/log.py | 16 +++++++++------- commands/make.py | 9 ++++++--- commands/makeinstall.py | 9 ++++++--- commands/package.py | 28 ++++++++++++++++------------ commands/patch.py | 5 +++-- commands/prepare.py | 9 +++++---- commands/run.py | 2 +- commands/shell.py | 13 ++++++++++--- commands/source.py | 5 +++-- commands/template.py | 15 ++++++++------- commands/test.py | 21 ++++++++++++--------- test/test/test_command.py | 8 ++++---- 25 files changed, 185 insertions(+), 126 deletions(-) diff --git a/commands/application.py b/commands/application.py index 222ff55..78c8e39 100644 --- a/commands/application.py +++ b/commands/application.py @@ -28,16 +28,20 @@ import src parser = src.options.Options() parser.add_option('n', 'name', 'string', 'name', - _('The name of the application (default is APPLI.name or runAppli)')) + _('Optional: The name of the application (default is APPLI.name or ' + 'runAppli)')) parser.add_option('c', 'catalog', 'string', 'catalog', - _('The resources catalog to use')) + _('Optional: The resources catalog to use')) parser.add_option('t', 'target', 'string', 'target', - _('The directory where to create the application (default is PRODUCT.out_dir)')) + _('Optional: The directory where to create the application (default is ' + 'APPLICATION.workdir)')) parser.add_option('', 'gencat', 'string', 'gencat', - _("""Create a resources catalog for the specified machines (separated with ',') -\tNOTICE: this command will ssh to retrieve information to each machine in the list""")) + _("Optional: Create a resources catalog for the specified machines " + "(separated with ',')\n\tNOTICE: this command will ssh to retrieve " + "information to each machine in the list")) parser.add_option('m', 'module', 'list2', 'modules', - _("module(s) to include in the application")) + _("Optional: the restricted list of module(s) to include in the " + "application")) ## # Creates an alias for runAppli. @@ -398,9 +402,10 @@ def description(): :return: The text to display for the application command description. :rtype: str ''' - return _("""The application command creates a SALOME application.\n""" - """WARNING: it works only for SALOME 6. Use the "launcher" """ - """command for newer versions of SALOME""") + return _("The application command creates a SALOME application.\n" + "WARNING: it works only for SALOME 6. Use the \"launcher\" " + "command for newer versions of SALOME\n\nexample:\nsat application" + " SALOME-6.6.0") ## # Runs the command. diff --git a/commands/base.py b/commands/base.py index cb40711..6df87b8 100644 --- a/commands/base.py +++ b/commands/base.py @@ -23,7 +23,7 @@ import src # Define all possible option for the shell command : sat base parser = src.options.Options() parser.add_option('s', 'set', 'string', 'base_path', - _('The path directory to use as base.'), None) + _('Optional: The path directory to use as base.'), None) def set_base(config, path, site_file_path, logger): """ Edit the site.pyconf file and change the base path @@ -70,7 +70,7 @@ def description(): :rtype: str ''' return _("Display or set the base where to put installations of base " - "products") + "products\n\nexample\nsat base --set /tmp/BASE") def run(args, runner, logger): '''method that is called when salomeTools is called with base parameter. diff --git a/commands/check.py b/commands/check.py index b9e1528..5b09e59 100644 --- a/commands/check.py +++ b/commands/check.py @@ -23,7 +23,7 @@ import src # Define all possible option for the check command : sat check parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('products to configure. This option can be' + _('Optional: products to configure. This option can be' ' passed several time to configure several products.')) def get_products_list(options, cfg, logger): @@ -163,7 +163,10 @@ def description(): :rtype: str ''' return _("The check command executes the \"check\" command in" - " the build directory") + " the build directory of all the products of the application." + "\nIt is possible to reduce the list of products to check by using" + " the --products option\n\nexample\nsat check SALOME-master " + "--products KERNEL,GUI,GEOM") def run(args, runner, logger): '''method that is called when salomeTools is called with check parameter. diff --git a/commands/clean.py b/commands/clean.py index 83459b7..07239bc 100644 --- a/commands/clean.py +++ b/commands/clean.py @@ -32,21 +32,21 @@ PROPERTY_EXPRESSION = "^.+:.+$" # Define all possible option for the clean command : sat clean parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('Products to clean. This option can be' + _('Optional: Products to clean. This option can be' ' passed several time to clean several products.')) parser.add_option('', 'properties', 'string', 'properties', - _('Filter the products by their properties.\n\tSyntax: ' + _('Optional: Filter the products by their properties.\n\tSyntax: ' '--properties :')) parser.add_option('s', 'sources', 'boolean', 'sources', - _("Clean the product source directories.")) + _("Optional: Clean the product source directories.")) parser.add_option('b', 'build', 'boolean', 'build', - _("Clean the product build directories.")) + _("Optional: Clean the product build directories.")) parser.add_option('i', 'install', 'boolean', 'install', - _("Clean the product install directories.")) + _("Optional: Clean the product install directories.")) parser.add_option('a', 'all', 'boolean', 'all', - _("Clean the product source, build and install directories.")) + _("Optional: Clean the product source, build and install directories.")) parser.add_option('', 'sources_without_dev', 'boolean', 'sources_without_dev', - _("do not clean the products in development mode.")) + _("Optional: do not clean the products in development mode.")) def get_products_list(options, cfg, logger): '''method that gives the product list with their informations from @@ -177,7 +177,10 @@ def description(): :rtype: str ''' return _("The clean command suppress the source, build, or install " - "directories of the application products.") + "directories of the application products.\nUse the options to" + " define what directories you want to suppress and to reduce " + "the list of products\n\nexample:\nsat clean SALOME-master " + "--build --install --properties is_salome_module:yes") def run(args, runner, logger): '''method that is called when salomeTools is called with clean parameter. diff --git a/commands/compile.py b/commands/compile.py index d2d1577..9a2d095 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -30,24 +30,27 @@ except NameError: # Define all possible option for the compile command : sat compile parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('products to configure. This option can be' + _('Optional: products to configure. This option can be' ' passed several time to configure several products.')) parser.add_option('', 'with_fathers', 'boolean', 'fathers', - _("build all necessary products to the given product (KERNEL is build before" - " building GUI)."), False) + _("Optional: build all necessary products to the given product (KERNEL is " + "build before building GUI)."), False) parser.add_option('', 'with_children', 'boolean', 'children', - _("build all products using the given product (all SMESH plugins are build " - "after SMESH)."), False) + _("Optional: build all products using the given product (all SMESH plugins" + " are build after SMESH)."), False) parser.add_option('', 'clean_all', 'boolean', 'clean_all', - _("clean BUILD dir and INSTALL dir before building product."), False) + _("Optional: clean BUILD dir and INSTALL dir before building product."), + False) parser.add_option('', 'clean_install', 'boolean', 'clean_install', - _("clean INSTALL dir before building product."), False) + _("Optional: clean INSTALL dir before building product."), False) parser.add_option('', 'make_flags', 'string', 'makeflags', - _("add extra options to the 'make' command.")) + _("Optional: add extra options to the 'make' command.")) parser.add_option('', 'show', 'boolean', 'no_compile', - _("DO NOT COMPILE just show if products are installed or not."), False) -parser.add_option('', 'stop_first_fail', 'boolean', 'stop_first_fail', _("Stop" - "s the command at first product compilation fail."), False) + _("Optional: DO NOT COMPILE just show if products are installed or not."), + False) +parser.add_option('', 'stop_first_fail', 'boolean', 'stop_first_fail', _( + "Optional: Stops the command at first product compilation" + " fail."), False) def get_products_list(options, cfg, logger): '''method that gives the product list with their informations from @@ -504,7 +507,9 @@ def description(): :return: The text to display for the compile command description. :rtype: str ''' - return _("The compile command constructs the products of the application") + return _("The compile command constructs the products of the application" + "\n\nexample:\nsat compile SALOME-master --products KERNEL,GUI," + "MEDCOUPLING --clean_all") def run(args, runner, logger): '''method that is called when salomeTools is called with compile parameter. diff --git a/commands/config.py b/commands/config.py index a330d46..07e28b6 100644 --- a/commands/config.py +++ b/commands/config.py @@ -32,19 +32,19 @@ gettext.install('salomeTools', os.path.join(satdir, 'src', 'i18n')) # Define all possible option for config command : sat config parser = src.options.Options() parser.add_option('v', 'value', 'string', 'value', - _("print the value of CONFIG_VARIABLE.")) + _("Optional: print the value of CONFIG_VARIABLE.")) parser.add_option('e', 'edit', 'boolean', 'edit', - _("edit the product configuration file.")) + _("Optional: edit the product configuration file.")) parser.add_option('i', 'info', 'string', 'info', - _("get information on a product.")) + _("Optional: get information on a product.")) parser.add_option('l', 'list', 'boolean', 'list', - _("list all available applications.")) + _("Optional: list all available applications.")) parser.add_option('c', 'copy', 'boolean', 'copy', - _("""copy a config file to the personal config files directory. + _("""Optional: copy a config file to the personal config files directory. \tWARNING the included files are not copied. \tIf a name is given the new config file takes the given name.""")) parser.add_option('n', 'no_label', 'boolean', 'no_label', - _("do not print labels, Works only with --value and --list.")) + _("Internal use: do not print labels, Works only with --value and --list.")) parser.add_option('s', 'schema', 'boolean', 'schema', _("Internal use.")) @@ -763,7 +763,8 @@ def description(): :rtype: str ''' return _("The config command allows manipulation " - "and operation on config files.") + "and operation on config files.\n\nexample:\nsat config " + "SALOME-master --info ParaView") def run(args, runner, logger): diff --git a/commands/configure.py b/commands/configure.py index 2fe672c..2fa43e7 100644 --- a/commands/configure.py +++ b/commands/configure.py @@ -23,10 +23,10 @@ import src # Define all possible option for configure command : sat configure parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('products to configure. This option can be' + _('Optional: products to configure. This option can be' ' passed several time to configure several products.')) parser.add_option('o', 'option', 'string', 'option', - _('Option to add to the configure or cmake command.'), "") + _('Optional: Option to add to the configure or cmake command.'), "") def get_products_list(options, cfg, logger): '''method that gives the product list with their informations from @@ -177,11 +177,12 @@ def description(): :rtype: str ''' return _("The configure command executes in the build directory" - " the configure commands corresponding to the compilation mode" + " the configure commands corresponding\nto the compilation mode" " of the application products.\nThe possible compilation modes" " are \"cmake\", \"autotools\", or a script.\n\nHere are the " "commands to be run :\nautotools: build_configure and configure\n" - "cmake: cmake\nscript: N\A") + "cmake: cmake\nscript: do nothing\n\nexample:\nsat configure " + "SALOME-master --products KERNEL,GUI,PARAVIS") def run(args, runner, logger): '''method that is called when salomeTools is called with make parameter. diff --git a/commands/environ.py b/commands/environ.py index 777efa6..a552fdd 100644 --- a/commands/environ.py +++ b/commands/environ.py @@ -22,14 +22,15 @@ import src parser = src.options.Options() parser.add_option('', 'shell', 'list2', 'shell', - _("Generates the environment files for the given format: " + _("Optional: Generates the environment files for the given format: " "bash (default), bat (for windows) or all."), []) parser.add_option('p', 'products', 'list2', 'products', - _("Includes only the specified products.")) + _("Optional: Includes only the specified products.")) parser.add_option('', 'prefix', 'string', 'prefix', - _("Specifies the prefix for the environment files."), "env") + _("Optional: Specifies the prefix for the environment files."), "env") parser.add_option('t', 'target', 'string', 'out_dir', - _("Specifies the directory path where to put the environment files."), + _("Optional: Specifies the directory path where to put the environment " + "files."), None) # list of available shells with extensions @@ -115,8 +116,8 @@ def write_all_source_files(config, ## # Describes the command def description(): - return _("The environ command generates the " - "environment files of your application.") + return _("The environ command generates the environment files of your " + "application.\n\nexample:\nsat environ SALOME-master") ## # Runs the command. diff --git a/commands/find_duplicates.py b/commands/find_duplicates.py index 3f346a4..4a6c5e5 100644 --- a/commands/find_duplicates.py +++ b/commands/find_duplicates.py @@ -31,22 +31,24 @@ parser.add_option("p", "path", "string", "path", - _("Search the duplicate files in the given directory path.")) + _("Optional: Search the duplicate files in the given " + "directory path.")) parser.add_option("", "exclude-file", "list2", "exclude_file", - _("Override the default list of filtered files.")) + _("Optional: Override the default list of filtered files.")) parser.add_option("", "exclude-extension", "list2", "exclude_extension", - _("Override the default list of filtered extensions.")) + _("Optional: Override the default list of filtered " + "extensions.")) parser.add_option("", "exclude-path", "list2", "exclude_path", - _("Override the default list of filtered pathes.")) + _("Optional: Override the default list of filtered paths.")) default_extension_ignored = ['html', 'png', 'txt', 'js', 'xml', 'cmake', 'gif', 'm4', 'in', 'pyo', 'pyc', 'doctree', 'css'] @@ -154,7 +156,8 @@ def description(): ''' return _("The find_duplicates command search recursively for all duplicates" " files in a the INSTALL directory (or the optionally given " - "directory) and prints the found files to the terminal.") + "directory) and prints the found files to the terminal.\n\n" + "example:\nsat find_duplicates --path /tmp") def run(args, runner, logger): '''method that is called when salomeTools is called with find_duplicates diff --git a/commands/generate.py b/commands/generate.py index b7d53f8..c60a22b 100644 --- a/commands/generate.py +++ b/commands/generate.py @@ -26,9 +26,9 @@ import src parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _("the list of products to generate")) + _("Optional: the list of products to generate")) parser.add_option('', 'yacsgen', 'string', 'yacsgen', - _("path to YACSGEN's module_generator package")) + _("Optional: path to YACSGEN's module_generator package")) def generate_component_list(config, product_info, context, logger): res = "?" @@ -301,7 +301,8 @@ def description(): :rtype: str ''' return _("The generate command generates SALOME modules from 'pure cpp' " - "products.\nWARNING this command NEEDS YACSGEN to run!") + "products.\nWARNING this command NEEDS YACSGEN to run!\n\nexample:" + "\nsat generate SALOME-master --products FLICACPP") def run(args, runner, logger): diff --git a/commands/job.py b/commands/job.py index e78a298..0b7ed6d 100644 --- a/commands/job.py +++ b/commands/job.py @@ -23,10 +23,10 @@ import src # Define all possible option for the make command : sat make parser = src.options.Options() parser.add_option('j', 'jobs_config', 'string', 'jobs_cfg', - _('The name of the config file that contains' + _('Mandatory: The name of the config file that contains' ' the jobs configuration')) parser.add_option('', 'name', 'string', 'job', - _('The job name from which to execute commands.'), "") + _('Mandatory: The job name from which to execute commands.'), "") def description(): '''method that is called when salomeTools is called with --help option. @@ -35,7 +35,8 @@ def description(): :rtype: str ''' return _("Executes the commands of the job defined" - " in the jobs configuration file") + " in the jobs configuration file\n\nexample:\nsat job " + "--jobs_config my_jobs --name my_job") def run(args, runner, logger): '''method that is called when salomeTools is called with job parameter. @@ -52,6 +53,12 @@ def run(args, runner, logger): logger.write(src.printcolors.printcError(message)) return 1 + # Make sure the name option has been called + if not options.job: + message = _("The option --name is required\n") + logger.write(src.printcolors.printcError(message)) + return 1 + # Find the file in the directories found = False for cfg_dir in l_cfg_dir: diff --git a/commands/jobs.py b/commands/jobs.py index 66392da..9ac0b12 100644 --- a/commands/jobs.py +++ b/commands/jobs.py @@ -37,7 +37,7 @@ CSV_DELIMITER = ";" parser = src.options.Options() parser.add_option('n', 'name', 'string', 'jobs_cfg', - _('The name of the config file that contains' + _('Mandatory: The name of the config file that contains' ' the jobs configuration')) parser.add_option('o', 'only_jobs', 'list2', 'only_jobs', _('Optional: the list of jobs to launch, by their name. ')) @@ -54,7 +54,7 @@ parser.add_option('p', 'publish', 'boolean', 'publish', parser.add_option('i', 'input_boards', 'string', 'input_boards', _("Optional: " "the path to csv file that contain " "the expected boards."),"") -parser.add_option('n', 'completion', 'boolean', 'no_label', +parser.add_option('', 'completion', 'boolean', 'no_label', _("Optional (internal use): do not print labels, Works only " "with --list."), False) @@ -1484,7 +1484,8 @@ class Gui(object): # Describes the command def description(): return _("The jobs command launches maintenances that are described" - " in the dedicated jobs configuration file.") + " in the dedicated jobs configuration file.\n\nexample:\nsat " + "jobs --name my_jobs --publish") ## # Runs the command. diff --git a/commands/launcher.py b/commands/launcher.py index 537aecb..3367535 100644 --- a/commands/launcher.py +++ b/commands/launcher.py @@ -27,12 +27,13 @@ import src parser = src.options.Options() -parser.add_option('n', 'name', 'string', 'name', _('The name of the launcher ' - '(default is APPLICATION.profile.launcher_name)')) +parser.add_option('n', 'name', 'string', 'name', _('Optional: The name of the' + ' launcher (default is ' + 'APPLICATION.profile.launcher_name)')) parser.add_option('c', 'catalog', 'string', 'catalog', - _('The resources catalog to use')) + _('Optional: The resources catalog to use')) parser.add_option('', 'gencat', 'string', 'gencat', - _("Create a resources catalog for the specified machines " + _("Optional: Create a resources catalog for the specified machines " "(separated with ',') \n\tNOTICE: this command will ssh to retrieve" " information to each machine in the list")) @@ -349,7 +350,8 @@ def finish_profile_install(config, launcherPath): ## # Describes the command def description(): - return _("The launcher command generates a salome launcher.") + return _("The launcher command generates a SALOME launcher.\n\nexample:" + "\nsat launcher SALOME-master") ## # Runs the command. diff --git a/commands/log.py b/commands/log.py index 504108d..83be789 100644 --- a/commands/log.py +++ b/commands/log.py @@ -32,13 +32,14 @@ import src # Define all possible option for log command : sat log parser = src.options.Options() -parser.add_option('t', 'terminal', 'boolean', 'terminal', "Terminal log.") +parser.add_option('t', 'terminal', 'boolean', 'terminal', "Optional: " + "Terminal log.") parser.add_option('l', 'last', 'boolean', 'last', "Show the log of the last " - "launched command.") -parser.add_option('f', 'full', 'boolean', 'full', "Show the logs of ALL " - "launched commands.") -parser.add_option('c', 'clean', 'int', 'clean', "Erase the n most ancient " - "log files.") + "Optional: launched command.") +parser.add_option('f', 'full', 'boolean', 'full', "Optional: Show the logs of " + "ALL the launched commands.") +parser.add_option('c', 'clean', 'int', 'clean', "Optional: Erase the n most " + "ancient log files.") def get_last_log_file(logDir, notShownCommands): '''Used in case of last option. Get the last log command file path. @@ -130,7 +131,8 @@ def description(): :return: The text to display for the log command description. :rtype: str ''' - return _("Gives access to the logs produced by the salomeTools commands.") + return _("Gives access to the logs produced by the salomeTools commands.\n" + "\nexample:\nsat log") def run(args, runner, logger): '''method that is called when salomeTools is called with log parameter. diff --git a/commands/make.py b/commands/make.py index a3b77ca..6cd7bac 100644 --- a/commands/make.py +++ b/commands/make.py @@ -24,10 +24,10 @@ import src # Define all possible option for the make command : sat make parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('products to configure. This option can be' + _('Optional: products to configure. This option can be' ' passed several time to configure several products.')) parser.add_option('o', 'option', 'string', 'option', - _('Option to add to the make command.'), "") + _('Optional: Option to add to the make command.'), "") def get_products_list(options, cfg, logger): '''method that gives the product list with their informations from @@ -208,7 +208,10 @@ def description(): :rtype: str ''' return _("The make command executes the \"make\" command in" - " the build directory") + " the build directory.\nIn case of a product that is constructed " + "using a script (build_source : \"script\"), then the make " + "command executes the script.\n\nexample:\nsat make SALOME-master " + "--products Python,KERNEL,GUI") def run(args, runner, logger): '''method that is called when salomeTools is called with make parameter. diff --git a/commands/makeinstall.py b/commands/makeinstall.py index 22409ab..2e8e8fd 100644 --- a/commands/makeinstall.py +++ b/commands/makeinstall.py @@ -23,8 +23,8 @@ import src # Define all possible option for the makeinstall command : sat makeinstall parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('products to configure. This option can be' - ' passed several time to configure several products.')) + _('Optional: products to install. This option can be' + ' passed several time to install several products.')) def get_products_list(options, cfg, logger): '''method that gives the product list with their informations from @@ -164,7 +164,10 @@ def description(): :rtype: str ''' return _("The makeinstall command executes the \"make install\" command in" - " the build directory") + " the build directory.\nIn case of product that is constructed " + "using a script (build_source : \"script\"), then the " + "makeinstall command do nothing.\n\nexample:\nsat makeinstall " + "SALOME-master --products KERNEL,GUI") def run(args, runner, logger): '''method that is called when salomeTools is called with makeinstall parameter. diff --git a/commands/package.py b/commands/package.py index a3b6083..2c670d4 100644 --- a/commands/package.py +++ b/commands/package.py @@ -79,23 +79,25 @@ project_file_paths : [$VARS.salometoolsway + $VARS.sep + \"..\" + $VARS.sep""" # Define all possible option for the package command : sat package parser = src.options.Options() parser.add_option('b', 'binaries', 'boolean', 'binaries', - _('Produce a binary package.'), False) + _('Optional: Produce a binary package.'), False) parser.add_option('f', 'force_creation', 'boolean', 'force_creation', - _('Only binary package: produce the archive even if there are some missing ' - 'products.'), False) + _('Optional: Only binary package: produce the archive even if ' + 'there are some missing products.'), False) parser.add_option('', 'with_sources', 'boolean', 'with_sources', - _('Only binary package: produce and and a source archive in the binary ' - 'package.'), False) + _('Optional: Only binary package: produce and and a source archive in the ' + 'binary package.'), False) parser.add_option('s', 'sources', 'boolean', 'sources', - _('Produce a compilable archive of the sources of the application.'), False) + _('Optional: Produce a compilable archive of the sources of the ' + 'application.'), False) parser.add_option('', 'with_vcs', 'boolean', 'with_vcs', - _('Only source package: do not make archive of vcs products.'), False) + _('Optional: Only source package: do not make archive of vcs products.'), + False) parser.add_option('p', 'project', 'string', 'project', - _('Produce an archive that contains a project.'), "") + _('Optional: Produce an archive that contains a project.'), "") parser.add_option('t', 'salometools', 'boolean', 'sat', - _('Produce an archive that contains salomeTools.'), False) + _('Optional: Produce an archive that contains salomeTools.'), False) parser.add_option('n', 'name', 'string', 'name', - _('The name or full path of the archive.'), None) + _('Optional: The name or full path of the archive.'), None) def add_files(tar, name_archive, d_content, logger): '''Create an archive containing all directories and files that are given in @@ -736,7 +738,8 @@ def description(): " It contains the products archives, a project corresponding to " "the application and salomeTools,\n 3- The project archive. It " "contains a project (give the project file path as argument),\n 4-" - " The salomeTools archive. It contains salomeTools.") + " The salomeTools archive. It contains salomeTools.\n\nexample:" + "\nsat package SALOME-master --sources") def run(args, runner, logger): '''method that is called when salomeTools is called with package parameter. @@ -754,7 +757,8 @@ def run(args, runner, logger): # Check if no option for package type if all_option_types.count(True) == 0: msg = _("Error: Precise a type for the package\nUse one of the " - "following options: --binaries, --sources, --project or --sat") + "following options: --binaries, --sources, --project or" + " --salometools") logger.write(src.printcolors.printcError(msg), 1) logger.write("\n", 1) return 1 diff --git a/commands/patch.py b/commands/patch.py index 2d12bbb..900753c 100644 --- a/commands/patch.py +++ b/commands/patch.py @@ -25,7 +25,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' + _('Optional: products to get the sources. This option can be' ' passed several time to get the sources of several products.')) def apply_patch(config, product_info, max_product_name_len, logger): @@ -118,7 +118,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. diff --git a/commands/prepare.py b/commands/prepare.py index eef6968..165efe6 100644 --- a/commands/prepare.py +++ b/commands/prepare.py @@ -23,12 +23,12 @@ import src # Define all possible option for prepare command : sat prepare parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('products to prepare. This option can be' + _('Optional: products to prepare. This option can be' ' passed several time to prepare several products.')) parser.add_option('f', 'force', 'boolean', 'force', - _("force to prepare the products in development mode.")) + _("Optional: force to prepare the products in development mode.")) parser.add_option('', 'force_patch', 'boolean', 'force_patch', - _("force to apply patch to the products in development mode.")) + _("Optional: force to apply patch to the products in development mode.")) def get_products_list(options, cfg, logger): '''method that gives the product list with their informations from @@ -87,7 +87,8 @@ def description(): :rtype: str ''' return _("The prepare command gets the sources of " - "the application products and apply the patches if there is any.") + "the application products and apply the patches if there is any." + "\n\nexample:\nsat prepare SALOME-master --products KERNEL,GUI") def run(args, runner, logger): '''method that is called when salomeTools is called with prepare parameter. diff --git a/commands/run.py b/commands/run.py index d5680bd..fe3fd9b 100644 --- a/commands/run.py +++ b/commands/run.py @@ -29,7 +29,7 @@ def description(): :rtype: str ''' return _("This command runs the application launcher" - " with the given arguments.") + " with the given arguments.\n\nexample:\nsat run SALOME-master") def run(args, runner, logger): '''method that is called when salomeTools is called with run parameter. diff --git a/commands/shell.py b/commands/shell.py index 4d722f0..b246072 100644 --- a/commands/shell.py +++ b/commands/shell.py @@ -23,7 +23,7 @@ import src # Define all possible option for the shell command : sat shell parser = src.options.Options() parser.add_option('c', 'command', 'string', 'command', - _('The shell command to execute.'), "") + _('Mandatory: The shell command to execute.'), "") def description(): '''method that is called when salomeTools is called with --help option. @@ -31,7 +31,8 @@ def description(): :return: The text to display for the shell command description. :rtype: str ''' - return _("Executes the shell command passed as argument") + return _("Executes the shell command passed as argument.\n\nexample:" + "\nsat shell --command \"ls \\-l /tmp\"") def run(args, runner, logger): '''method that is called when salomeTools is called with shell parameter. @@ -39,7 +40,13 @@ def run(args, runner, logger): # Parse the options (options, args) = parser.parse_args(args) - + + # Make sure the command option has been called + if not options.command: + message = _("The option --command is required\n") + logger.write(src.printcolors.printcError(message)) + return 1 + res = subprocess.call(options.command, shell=True, stdout=logger.logTxtFile, diff --git a/commands/source.py b/commands/source.py index 8ca970d..b40a6b4 100644 --- a/commands/source.py +++ b/commands/source.py @@ -25,7 +25,7 @@ import prepare # Define all possible option for patch command : sat patch parser = src.options.Options() parser.add_option('p', 'products', 'list2', 'products', - _('products from which to get the sources. This option can be' + _('Optional: products from which to get the sources. This option can be' ' passed several time to get the sources of several products.')) def get_source_for_dev(config, product_info, source_dir, logger, pad): @@ -464,7 +464,8 @@ def description(): :rtype: str ''' return _("The source command gets the sources of the application products " - "from cvs, git, an archive or a directory..") + "from cvs, git or an archive.\n\nexample:" + "\nsat source SALOME-master --products KERNEL,GUI") def run(args, runner, logger): '''method that is called when salomeTools is called with source parameter. diff --git a/commands/template.py b/commands/template.py index c7cfb32..142bdb6 100644 --- a/commands/template.py +++ b/commands/template.py @@ -34,21 +34,21 @@ except NameError: parser = src.options.Options() parser.add_option('n', 'name', 'string', 'name', - _("""REQUIRED the name of the module to create. + _("""REQUIRED: the name of the module to create. \tThe name must be a single word in upper case with only alphanumeric characters. \tWhen generating a c++ component the module's """ """name must be suffixed with 'CPP'.""")) parser.add_option('t', 'template', 'string', 'template', - _('REQUIRED the template to use.')) + _('REQUIRED: the template to use.')) parser.add_option('', 'target', 'string', 'target', - _('REQUIRED where to create the module.')) + _('REQUIRED: where to create the module.')) parser.add_option('', 'param', 'string', 'param', - _('''dictionary to generate the configuration for salomeTools. + _('''Optional: dictionary to generate the configuration for salomeTools. \tFormat is: --param param1=value1,param2=value2... without spaces \tNote that when using this option you must supply all the ''' '''values otherwise an error will be raised.''')) parser.add_option('', 'info', 'boolean', 'info', - _('Get information on the template.'), False) + _('Optional: Get information on the template.'), False) class TParam: def __init__(self, param_def, compo_name, dico=None): @@ -431,8 +431,9 @@ def get_template_info(config, template_name, logger): ## # Describes the command def description(): - return _("""The template command creates the sources for a SALOME """ - """module from a template.""") + return _("The template command creates the sources for a SALOME " + "module from a template.\n\nexample\nsat template " + "--name my_product_name --template PythonComponent --target /tmp") def run(args, runner, logger): '''method that is called when salomeTools is called with template parameter. diff --git a/commands/test.py b/commands/test.py index 3b17e55..3bdcd8a 100644 --- a/commands/test.py +++ b/commands/test.py @@ -35,18 +35,20 @@ from src.xmlManager import add_simple_node # Define all possible option for the test command : sat test parser = src.options.Options() parser.add_option('b', 'base', 'string', 'base', - _("Indicate the name of the test base to use.\n\tThis name has to be " - "registered in your application and in a project.\n\tA path to a test " - "base can also be used.")) + _("Optional: Indicate the name of the test base to use.\n\tThis name has to" + " be registered in your application and in a project.\n\tA path to a " + "test base can also be used.")) parser.add_option('l', 'launcher', 'string', 'launcher', - _("Use this option to specify the path to a SALOME launcher to use to " - "launch the test scripts of the test base.")) + _("Optional: Use this option to specify the path to a SALOME launcher to " + "use to launch the test scripts of the test base.")) parser.add_option('g', 'grid', 'list', 'grids', - _('Indicate which grid(s) to test (subdirectory of the test base).')) + _('Optional: Indicate which grid(s) to test (subdirectory of the test ' + 'base).')) parser.add_option('s', 'session', 'list', 'sessions', - _('Indicate which session(s) to test (subdirectory of the grid).')) + _('Optional: indicate which session(s) to test (subdirectory of the ' + 'grid).')) parser.add_option('', 'display', 'string', 'display', - _("Set the display where to launch SALOME." + _("Optional: set the display where to launch SALOME." "\tIf value is NO then option --show-desktop=0 will be used to launch SALOME.")) def description(): @@ -55,7 +57,8 @@ def description(): :return: The text to display for the test command description. :rtype: str ''' - return _("The test command runs a test base on a SALOME installation.") + return _("The test command runs a test base on a SALOME installation.\n\n" + "example:\nsat test SALOME-master --grid GEOM --session light") def parse_option(args, config): """ Parse the options and do some verifications about it diff --git a/test/test/test_command.py b/test/test/test_command.py index 9146376..ed67701 100644 --- a/test/test/test_command.py +++ b/test/test/test_command.py @@ -43,7 +43,7 @@ class TestTest(unittest.TestCase): sat = Sat("-l " + tmp_file) # Execute the job command - sat.test(application + " --module GEOM --type light" ) + sat.test(application + " --grid GEOM --session light" ) ff = open(tmp_file, "r") log_files = ff.readlines() @@ -53,7 +53,7 @@ class TestTest(unittest.TestCase): text = open(log_testboard[0], "r").read() - if '' in text: + if '' in text: OK = 'OK' # pyunit method to compare 2 str self.assertEqual(OK, 'OK') @@ -68,7 +68,7 @@ class TestTest(unittest.TestCase): sat = Sat("-l " + tmp_file) # Execute the job command - sat.test(application + " --module MED --type PY_test_withKernel" ) + sat.test(application + " --grid MED --session PY_test_withKernel" ) ff = open(tmp_file, "r") log_files = ff.readlines() @@ -78,7 +78,7 @@ class TestTest(unittest.TestCase): text = open(log_testboard[0], "r").read() - if '' in text: + if '' in text: OK = 'OK' # pyunit method to compare 2 str self.assertEqual(OK, 'OK') -- 2.39.2