xmipp3-installer 1.0.0__py3-none-any.whl → 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. xmipp3_installer/__main__.py +1 -1
  2. xmipp3_installer/api_client/api_client.py +35 -34
  3. xmipp3_installer/api_client/assembler/installation_info_assembler.py +140 -145
  4. xmipp3_installer/application/cli/arguments/__init__.py +3 -2
  5. xmipp3_installer/application/cli/arguments/modes.py +112 -95
  6. xmipp3_installer/application/cli/arguments/params.py +63 -53
  7. xmipp3_installer/application/cli/cli.py +171 -190
  8. xmipp3_installer/application/cli/parsers/base_help_formatter.py +256 -235
  9. xmipp3_installer/application/cli/parsers/error_handler_parser.py +53 -53
  10. xmipp3_installer/application/cli/parsers/format.py +22 -22
  11. xmipp3_installer/application/cli/parsers/general_help_formatter.py +102 -84
  12. xmipp3_installer/application/cli/parsers/mode_help_formatter.py +144 -105
  13. xmipp3_installer/application/logger/__init__.py +5 -0
  14. xmipp3_installer/application/logger/errors.py +8 -8
  15. xmipp3_installer/application/logger/logger.py +218 -215
  16. xmipp3_installer/application/logger/predefined_messages.py +42 -35
  17. xmipp3_installer/application/user_interactions.py +6 -0
  18. xmipp3_installer/installer/constants/paths.py +6 -1
  19. xmipp3_installer/installer/handlers/cmake/cmake_handler.py +49 -53
  20. xmipp3_installer/installer/handlers/conda_handler.py +6 -6
  21. xmipp3_installer/installer/handlers/generic_package_handler.py +9 -9
  22. xmipp3_installer/installer/handlers/git_handler.py +152 -153
  23. xmipp3_installer/installer/handlers/shell_handler.py +87 -88
  24. xmipp3_installer/installer/handlers/versions_manager.py +20 -6
  25. xmipp3_installer/installer/installer_service.py +22 -8
  26. xmipp3_installer/installer/modes/mode_all_executor.py +61 -51
  27. xmipp3_installer/installer/modes/mode_clean/mode_clean_all_executor.py +44 -36
  28. xmipp3_installer/installer/modes/mode_clean/mode_clean_bin_executor.py +84 -74
  29. xmipp3_installer/installer/modes/mode_clean/mode_clean_executor.py +48 -34
  30. xmipp3_installer/installer/modes/mode_cmake/mode_cmake_executor.py +60 -47
  31. xmipp3_installer/installer/modes/mode_cmake/mode_compile_and_install_executor.py +52 -39
  32. xmipp3_installer/installer/modes/mode_cmake/mode_config_build_executor.py +68 -49
  33. xmipp3_installer/installer/modes/mode_config_executor.py +44 -33
  34. xmipp3_installer/installer/modes/mode_executor.py +14 -13
  35. xmipp3_installer/installer/modes/mode_get_sources_executor.py +121 -112
  36. xmipp3_installer/installer/modes/mode_git_executor.py +43 -31
  37. xmipp3_installer/installer/modes/mode_selector.py +6 -0
  38. xmipp3_installer/installer/modes/mode_sync/mode_add_model_executor.py +97 -83
  39. xmipp3_installer/installer/modes/mode_sync/mode_get_models_executor.py +53 -41
  40. xmipp3_installer/installer/modes/mode_sync/mode_sync_executor.py +41 -35
  41. xmipp3_installer/installer/modes/mode_sync/mode_test_executor.py +144 -77
  42. xmipp3_installer/installer/modes/mode_version_executor.py +161 -150
  43. xmipp3_installer/installer/orquestrator.py +24 -24
  44. xmipp3_installer/installer/urls.py +4 -3
  45. xmipp3_installer/repository/config.py +225 -227
  46. xmipp3_installer/repository/config_vars/__init__.py +5 -0
  47. xmipp3_installer/repository/config_vars/config_values_adapter.py +97 -91
  48. xmipp3_installer/repository/config_vars/default_values.py +24 -24
  49. xmipp3_installer/repository/config_vars/variables.py +9 -9
  50. xmipp3_installer/repository/invalid_config_line.py +17 -0
  51. xmipp3_installer/shared/file_operations.py +14 -12
  52. xmipp3_installer/shared/singleton.py +16 -17
  53. xmipp3_installer-1.1.0.dist-info/METADATA +86 -0
  54. xmipp3_installer-1.1.0.dist-info/RECORD +70 -0
  55. {xmipp3_installer-1.0.0.dist-info → xmipp3_installer-1.1.0.dist-info}/WHEEL +1 -1
  56. xmipp3_installer-1.0.0.dist-info/METADATA +0 -729
  57. xmipp3_installer-1.0.0.dist-info/RECORD +0 -70
  58. {xmipp3_installer-1.0.0.dist-info → xmipp3_installer-1.1.0.dist-info}/entry_points.txt +0 -0
  59. /xmipp3_installer-1.0.0.dist-info/LICENSE → /xmipp3_installer-1.1.0.dist-info/licenses/LICENSE.txt +0 -0
  60. {xmipp3_installer-1.0.0.dist-info → xmipp3_installer-1.1.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  """### Containis all param constants needed for the argument parsing part of Xmipp's installation."""
2
2
 
3
- from xmipp3_installer.application.cli.arguments import DEFAULT_BUILD_DIR
3
+ from xmipp3_installer.application.cli import arguments
4
4
 
5
5
  # Definition of all params found in the
6
6
  SHORT_VERSION = 'short'
@@ -14,6 +14,8 @@ PARAM_BRANCH = 'branch'
14
14
  PARAM_MODELS_DIRECTORY = 'directory'
15
15
  PARAM_TEST_NAMES = 'testNames'
16
16
  PARAM_SHOW_TESTS = 'show'
17
+ PARAM_ALL_FUNCTIONS = 'all_functions'
18
+ PARAM_ALL_PROGRAMS = 'all_programs'
17
19
  PARAM_GIT_COMMAND = 'command'
18
20
  PARAM_LOGIN = 'login'
19
21
  PARAM_MODEL_PATH = 'modelPath'
@@ -21,56 +23,64 @@ PARAM_UPDATE = 'update'
21
23
  PARAM_OVERWRITE = 'overwrite'
22
24
  PARAM_KEEP_OUTPUT = "keep_output"
23
25
  PARAMS = {
24
- PARAM_SHORT: {
25
- LONG_VERSION: "--short",
26
- DESCRIPTION: "If set, only version number is shown."
27
- },
28
- PARAM_JOBS: {
29
- SHORT_VERSION: "-j",
30
- LONG_VERSION: "--jobs",
31
- DESCRIPTION: "Number of jobs. Defaults to all available."
32
- },
33
- PARAM_BRANCH: {
34
- SHORT_VERSION: "-b",
35
- LONG_VERSION: "--branch",
36
- DESCRIPTION: "Branch for the source repositories."
37
- },
38
- PARAM_MODELS_DIRECTORY: {
39
- SHORT_VERSION: "-d",
40
- LONG_VERSION: "--directory",
41
- DESCRIPTION: f"Directory where models will be saved. Default is \"{DEFAULT_BUILD_DIR}\"."
42
- },
43
- PARAM_TEST_NAMES: {
44
- SHORT_VERSION: PARAM_TEST_NAMES,
45
- DESCRIPTION: "Name of the tests to run. If combined with --show, greps the test names from the test list."
46
- },
47
- PARAM_SHOW_TESTS: {
48
- LONG_VERSION: "--show",
49
- DESCRIPTION: "Shows the tests available and how to invoke those."
50
- },
51
- PARAM_GIT_COMMAND: {
52
- SHORT_VERSION: PARAM_GIT_COMMAND,
53
- DESCRIPTION: "Git command to run on all source repositories."
54
- },
55
- PARAM_LOGIN: {
56
- SHORT_VERSION: "login",
57
- DESCRIPTION: "Login (usr@server) for remote host to upload the model with. Must have write permisions to such machine."
58
- },
59
- PARAM_MODEL_PATH: {
60
- SHORT_VERSION: PARAM_MODEL_PATH,
61
- DESCRIPTION: "Path to the model to upload to remote host."
62
- },
63
- PARAM_UPDATE: {
64
- LONG_VERSION: "--update",
65
- DESCRIPTION: "Flag to update an existing model"
66
- },
67
- PARAM_OVERWRITE: {
68
- SHORT_VERSION: "-o",
69
- LONG_VERSION: "--overwrite",
70
- DESCRIPTION: "If set, current config file will be overwritten with a new one."
71
- },
72
- PARAM_KEEP_OUTPUT: {
73
- LONG_VERSION: "--keep-output",
74
- DESCRIPTION: "If set, output sent through the terminal won't substitute lines, looking more like the log."
75
- }
26
+ PARAM_SHORT: {
27
+ LONG_VERSION: "--short",
28
+ DESCRIPTION: "If set, only version number is shown."
29
+ },
30
+ PARAM_JOBS: {
31
+ SHORT_VERSION: "-j",
32
+ LONG_VERSION: "--jobs",
33
+ DESCRIPTION: "Number of jobs. Defaults to all available."
34
+ },
35
+ PARAM_BRANCH: {
36
+ SHORT_VERSION: "-b",
37
+ LONG_VERSION: "--branch",
38
+ DESCRIPTION: "Branch for the source repositories."
39
+ },
40
+ PARAM_MODELS_DIRECTORY: {
41
+ SHORT_VERSION: "-d",
42
+ LONG_VERSION: "--directory",
43
+ DESCRIPTION: f"Directory where models will be saved. Default is \"{arguments.DEFAULT_MODELS_DIR}\"."
44
+ },
45
+ PARAM_TEST_NAMES: {
46
+ SHORT_VERSION: PARAM_TEST_NAMES,
47
+ DESCRIPTION: "Name of the tests to run."
48
+ },
49
+ PARAM_SHOW_TESTS: {
50
+ LONG_VERSION: "--show",
51
+ DESCRIPTION: "Shows the tests available and how to invoke those."
52
+ },
53
+ PARAM_ALL_FUNCTIONS : {
54
+ LONG_VERSION: "--all-functions",
55
+ DESCRIPTION: "If set, all function tests will be run."
56
+ },
57
+ PARAM_ALL_PROGRAMS : {
58
+ LONG_VERSION: "--all-programs",
59
+ DESCRIPTION: "If set, all program tests will be run."
60
+ },
61
+ PARAM_GIT_COMMAND: {
62
+ SHORT_VERSION: PARAM_GIT_COMMAND,
63
+ DESCRIPTION: "Git command to run on all source repositories."
64
+ },
65
+ PARAM_LOGIN: {
66
+ SHORT_VERSION: "login",
67
+ DESCRIPTION: "Login (usr@server) for remote host to upload the model with. Must have write permissions to such machine."
68
+ },
69
+ PARAM_MODEL_PATH: {
70
+ SHORT_VERSION: PARAM_MODEL_PATH,
71
+ DESCRIPTION: "Path to the model to upload to remote host."
72
+ },
73
+ PARAM_UPDATE: {
74
+ LONG_VERSION: "--update",
75
+ DESCRIPTION: "Flag to update an existing model"
76
+ },
77
+ PARAM_OVERWRITE: {
78
+ SHORT_VERSION: "-o",
79
+ LONG_VERSION: "--overwrite",
80
+ DESCRIPTION: "If set, current config file will be overwritten with a new one."
81
+ },
82
+ PARAM_KEEP_OUTPUT: {
83
+ LONG_VERSION: "--keep-output",
84
+ DESCRIPTION: "If set, output sent through the terminal won't substitute lines, looking more like the log."
85
+ }
76
86
  }
@@ -16,256 +16,237 @@ from xmipp3_installer.application.logger.logger import logger
16
16
  from xmipp3_installer.installer import installer_service
17
17
 
18
18
  def main():
19
- """### Main entry point function that starts the execution."""
20
- parser = __generate_parser()
21
- parser = __add_params(parser)
22
- __add_default_usage_mode()
23
- args = vars(parser.parse_args())
24
- __validate_args(args, parser)
25
- installation_manager = installer_service.InstallationManager(args)
26
- ret_code = installation_manager.run_installer()
27
- sys.exit(ret_code)
19
+ """### Main entry point function that starts the execution."""
20
+ parser = __generate_parser()
21
+ parser = __add_params(parser)
22
+ __add_default_usage_mode()
23
+ args = vars(parser.parse_args())
24
+ __validate_args(args, parser)
25
+ installation_manager = installer_service.InstallationManager(args)
26
+ ret_code = installation_manager.run_installer()
27
+ sys.exit(ret_code)
28
28
 
29
29
  def __generate_parser() -> argparse.ArgumentParser:
30
- """
31
- ### Generates an argument parser for the installer.
30
+ """
31
+ ### Generates an argument parser for the installer.
32
32
 
33
- #### Returns:
34
- - (ArgumentParser): Argument parser.
35
- """
36
- return ErrorHandlerArgumentParser(
37
- prog=arguments.XMIPP_PROGRAM_NAME,
38
- formatter_class=GeneralHelpFormatter,
39
- )
33
+ #### Returns:
34
+ - (ArgumentParser): Argument parser.
35
+ """
36
+ return ErrorHandlerArgumentParser(
37
+ prog=arguments.XMIPP_PROGRAM_NAME,
38
+ formatter_class=GeneralHelpFormatter,
39
+ )
40
40
 
41
41
  def __add_params(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
42
- """
43
- ### Inserts the params into the given parser.
42
+ """
43
+ ### Inserts the params into the given parser.
44
44
 
45
- #### Params:
46
- - parser (ArgumentParser): Argument parser.
45
+ #### Params:
46
+ - parser (ArgumentParser): Argument parser.
47
47
 
48
- #### Returns:
49
- - (ArgumentParser): Argument parser with inserted params.
50
- """
51
- subparsers = parser.add_subparsers(dest=modes.MODE)
52
- default_jobs = __get_default_job_number()
48
+ #### Returns:
49
+ - (ArgumentParser): Argument parser with inserted params.
50
+ """
51
+ subparsers = parser.add_subparsers(dest=modes.MODE)
52
+ default_jobs = __get_default_job_number()
53
53
 
54
- add_model_subparser = subparsers.add_parser(modes.MODE_ADD_MODEL, formatter_class=ModeHelpFormatter)
55
- __add_params_mode_add_model(add_model_subparser)
54
+ add_model_subparser = subparsers.add_parser(modes.MODE_ADD_MODEL, formatter_class=ModeHelpFormatter)
55
+ __add_params_mode_add_model(add_model_subparser)
56
56
 
57
- all_subparser = subparsers.add_parser(modes.MODE_ALL, formatter_class=ModeHelpFormatter)
58
- __add_params_mode_all(all_subparser, default_jobs)
57
+ all_subparser = subparsers.add_parser(modes.MODE_ALL, formatter_class=ModeHelpFormatter)
58
+ __add_params_mode_all(all_subparser, default_jobs)
59
59
 
60
- subparsers.add_parser(modes.MODE_CLEAN_ALL, formatter_class=ModeHelpFormatter)
60
+ subparsers.add_parser(modes.MODE_CLEAN_ALL, formatter_class=ModeHelpFormatter)
61
61
 
62
- subparsers.add_parser(modes.MODE_CLEAN_BIN, formatter_class=ModeHelpFormatter)
62
+ subparsers.add_parser(modes.MODE_CLEAN_BIN, formatter_class=ModeHelpFormatter)
63
63
 
64
- compile_and_install_subparser = subparsers.add_parser(modes.MODE_COMPILE_AND_INSTALL, formatter_class=ModeHelpFormatter)
65
- __add_params_mode_compile_and_install(compile_and_install_subparser, default_jobs)
64
+ compile_and_install_subparser = subparsers.add_parser(modes.MODE_COMPILE_AND_INSTALL, formatter_class=ModeHelpFormatter)
65
+ __add_params_mode_compile_and_install(compile_and_install_subparser, default_jobs)
66
66
 
67
- build_config_subparser = subparsers.add_parser(modes.MODE_CONFIG_BUILD, formatter_class=ModeHelpFormatter)
68
- __add_params_mode_config_build(build_config_subparser)
67
+ build_config_subparser = subparsers.add_parser(modes.MODE_CONFIG_BUILD, formatter_class=ModeHelpFormatter)
68
+ __add_params_mode_config_build(build_config_subparser)
69
69
 
70
- config_subparser = subparsers.add_parser(modes.MODE_CONFIG, formatter_class=ModeHelpFormatter)
71
- __add_params_mode_config(config_subparser)
70
+ config_subparser = subparsers.add_parser(modes.MODE_CONFIG, formatter_class=ModeHelpFormatter)
71
+ __add_params_mode_config(config_subparser)
72
72
 
73
- get_models_subparser = subparsers.add_parser(modes.MODE_GET_MODELS, formatter_class=ModeHelpFormatter)
74
- __add_params_mode_get_models(get_models_subparser)
73
+ get_models_subparser = subparsers.add_parser(modes.MODE_GET_MODELS, formatter_class=ModeHelpFormatter)
74
+ __add_params_mode_get_models(get_models_subparser)
75
75
 
76
- get_sources_subparser = subparsers.add_parser(modes.MODE_GET_SOURCES, formatter_class=ModeHelpFormatter)
77
- __add_params_mode_get_sources(get_sources_subparser)
76
+ get_sources_subparser = subparsers.add_parser(modes.MODE_GET_SOURCES, formatter_class=ModeHelpFormatter)
77
+ __add_params_mode_get_sources(get_sources_subparser)
78
78
 
79
- git_subparser = subparsers.add_parser(modes.MODE_GIT, formatter_class=ModeHelpFormatter)
80
- __add_params_mode_git(git_subparser)
79
+ git_subparser = subparsers.add_parser(modes.MODE_GIT, formatter_class=ModeHelpFormatter)
80
+ __add_params_mode_git(git_subparser)
81
81
 
82
- test_subparser = subparsers.add_parser(modes.MODE_TEST, formatter_class=ModeHelpFormatter)
83
- __add_params_mode_test(test_subparser)
82
+ test_subparser = subparsers.add_parser(modes.MODE_TEST, formatter_class=ModeHelpFormatter)
83
+ __add_params_mode_test(test_subparser)
84
84
 
85
- version_subparser = subparsers.add_parser(modes.MODE_VERSION, formatter_class=ModeHelpFormatter)
86
- __add_params_mode_version(version_subparser)
85
+ version_subparser = subparsers.add_parser(modes.MODE_VERSION, formatter_class=ModeHelpFormatter)
86
+ __add_params_mode_version(version_subparser)
87
87
 
88
- return parser
88
+ return parser
89
89
 
90
90
  def __add_params_mode_add_model(subparser: argparse.ArgumentParser):
91
- """
92
- ### Adds params for mode "addModel"
91
+ """
92
+ ### Adds params for mode "addModel".
93
93
 
94
- #### Params:
95
- - subparser (ArgumentParser): Subparser to add the params to.
96
- """
97
- subparser.add_argument(*format.get_param_names(params.PARAM_LOGIN))
98
- subparser.add_argument(*format.get_param_names(params.PARAM_MODEL_PATH))
99
- subparser.add_argument(*format.get_param_names(params.PARAM_UPDATE), action='store_true')
94
+ #### Params:
95
+ - subparser (ArgumentParser): Subparser to add the params to.
96
+ """
97
+ subparser.add_argument(*format.get_param_names(params.PARAM_LOGIN))
98
+ subparser.add_argument(*format.get_param_names(params.PARAM_MODEL_PATH))
99
+ subparser.add_argument(*format.get_param_names(params.PARAM_UPDATE), action='store_true')
100
100
 
101
101
  def __add_params_mode_all(subparser: argparse.ArgumentParser, default_jobs: int):
102
- """
103
- ### Adds params for mode "all"
102
+ """
103
+ ### Adds params for mode "all".
104
104
 
105
- #### Params:
106
- - subparser (ArgumentParser): Subparser to add the params to.
107
- - default_jobs (int): Default number of jobs to run the task.
108
- """
109
- subparser.add_argument(*format.get_param_names(params.PARAM_JOBS), type=int, default=default_jobs)
110
- subparser.add_argument(*format.get_param_names(params.PARAM_BRANCH))
111
- subparser.add_argument(*format.get_param_names(params.PARAM_KEEP_OUTPUT), action='store_true')
105
+ #### Params:
106
+ - subparser (ArgumentParser): Subparser to add the params to.
107
+ - default_jobs (int): Default number of jobs to run the task.
108
+ """
109
+ subparser.add_argument(*format.get_param_names(params.PARAM_JOBS), type=int, default=default_jobs)
110
+ subparser.add_argument(*format.get_param_names(params.PARAM_BRANCH))
111
+ subparser.add_argument(*format.get_param_names(params.PARAM_KEEP_OUTPUT), action='store_true')
112
112
 
113
113
  def __add_params_mode_compile_and_install(subparser: argparse.ArgumentParser, default_jobs: int):
114
- """
115
- ### Adds params for mode "compileAndInstall"
114
+ """
115
+ ### Adds params for mode "compileAndInstall".
116
116
 
117
- #### Params:
118
- - subparser (ArgumentParser): Subparser to add the params to.
119
- - default_jobs (int): Default number of jobs to run the task.
120
- """
121
- subparser.add_argument(*format.get_param_names(params.PARAM_JOBS), type=int, default=default_jobs)
122
- subparser.add_argument(*format.get_param_names(params.PARAM_BRANCH))
123
- subparser.add_argument(*format.get_param_names(params.PARAM_KEEP_OUTPUT), action='store_true')
117
+ #### Params:
118
+ - subparser (ArgumentParser): Subparser to add the params to.
119
+ - default_jobs (int): Default number of jobs to run the task.
120
+ """
121
+ subparser.add_argument(*format.get_param_names(params.PARAM_JOBS), type=int, default=default_jobs)
122
+ subparser.add_argument(*format.get_param_names(params.PARAM_BRANCH))
123
+ subparser.add_argument(*format.get_param_names(params.PARAM_KEEP_OUTPUT), action='store_true')
124
124
 
125
125
  def __add_params_mode_config_build(subparser: argparse.ArgumentParser):
126
- """
127
- ### Adds params for mode "configBuild"
126
+ """
127
+ ### Adds params for mode "configBuild".
128
128
 
129
- #### Params:
130
- - subparser (ArgumentParser): Subparser to add the params to.
131
- """
132
- subparser.add_argument(*format.get_param_names(params.PARAM_KEEP_OUTPUT), action='store_true')
129
+ #### Params:
130
+ - subparser (ArgumentParser): Subparser to add the params to.
131
+ """
132
+ subparser.add_argument(*format.get_param_names(params.PARAM_KEEP_OUTPUT), action='store_true')
133
133
 
134
134
  def __add_params_mode_config(subparser: argparse.ArgumentParser):
135
- """
136
- ### Adds params for mode "config"
135
+ """
136
+ ### Adds params for mode "config".
137
137
 
138
- #### Params:
139
- - subparser (ArgumentParser): Subparser to add the params to.
140
- """
141
- subparser.add_argument(*format.get_param_names(params.PARAM_OVERWRITE), action='store_true')
138
+ #### Params:
139
+ - subparser (ArgumentParser): Subparser to add the params to.
140
+ """
141
+ subparser.add_argument(*format.get_param_names(params.PARAM_OVERWRITE), action='store_true')
142
142
 
143
143
  def __add_params_mode_get_models(subparser: argparse.ArgumentParser):
144
- """
145
- ### Adds params for mode "getModels"
144
+ """
145
+ ### Adds params for mode "getModels".
146
146
 
147
- #### Params:
148
- - subparser (ArgumentParser): Subparser to add the params to.
149
- """
150
- subparser.add_argument(
151
- *format.get_param_names(params.PARAM_MODELS_DIRECTORY),
152
- default=__get_project_root_subpath(arguments.DEFAULT_MODELS_DIR)
153
- )
147
+ #### Params:
148
+ - subparser (ArgumentParser): Subparser to add the params to.
149
+ """
150
+ subparser.add_argument(
151
+ *format.get_param_names(params.PARAM_MODELS_DIRECTORY),
152
+ default=os.path.abspath(arguments.DEFAULT_MODELS_DIR)
153
+ )
154
154
 
155
155
  def __add_params_mode_get_sources(subparser: argparse.ArgumentParser):
156
- """
157
- ### Adds params for mode "getSources"
156
+ """
157
+ ### Adds params for mode "getSources".
158
158
 
159
- #### Params:
160
- - subparser (ArgumentParser): Subparser to add the params to.
161
- """
162
- subparser.add_argument(*format.get_param_names(params.PARAM_BRANCH))
163
- subparser.add_argument(*format.get_param_names(params.PARAM_KEEP_OUTPUT), action='store_true')
159
+ #### Params:
160
+ - subparser (ArgumentParser): Subparser to add the params to.
161
+ """
162
+ subparser.add_argument(*format.get_param_names(params.PARAM_BRANCH))
163
+ subparser.add_argument(*format.get_param_names(params.PARAM_KEEP_OUTPUT), action='store_true')
164
164
 
165
165
  def __add_params_mode_git(subparser: argparse.ArgumentParser):
166
- """
167
- ### Adds params for mode "git"
166
+ """
167
+ ### Adds params for mode "git".
168
168
 
169
- #### Params:
170
- - subparser (ArgumentParser): Subparser to add the params to.
171
- """
172
- subparser.add_argument(*format.get_param_names(params.PARAM_GIT_COMMAND), nargs='+')
169
+ #### Params:
170
+ - subparser (ArgumentParser): Subparser to add the params to.
171
+ """
172
+ subparser.add_argument(*format.get_param_names(params.PARAM_GIT_COMMAND), nargs='+')
173
173
 
174
174
  def __add_params_mode_test(subparser: argparse.ArgumentParser):
175
- """
176
- ### Adds params for mode "test"
177
-
178
- #### Params:
179
- - subparser (ArgumentParser): Subparser to add the params to.
180
- """
181
- subparser.add_argument(*format.get_param_names(params.PARAM_TEST_NAMES), nargs='*', default=None)
182
- subparser.add_argument(*format.get_param_names(params.PARAM_SHOW_TESTS), action='store_true')
175
+ """
176
+ ### Adds params for mode "test".
177
+
178
+ #### Params:
179
+ - subparser (ArgumentParser): Subparser to add the params to.
180
+ """
181
+ group = subparser.add_mutually_exclusive_group(required=True)
182
+ group.add_argument(*format.get_param_names(params.PARAM_TEST_NAMES), nargs='*', default=[])
183
+ group.add_argument(*format.get_param_names(params.PARAM_SHOW_TESTS), action='store_true')
184
+ group.add_argument(*format.get_param_names(params.PARAM_ALL_FUNCTIONS), action='store_true')
185
+ group.add_argument(*format.get_param_names(params.PARAM_ALL_PROGRAMS), action='store_true')
183
186
 
184
187
  def __add_params_mode_version(subparser: argparse.ArgumentParser):
185
- """
186
- ### Adds params for mode "version"
188
+ """
189
+ ### Adds params for mode "version".
187
190
 
188
- #### Params:
189
- - subparser (ArgumentParser): Subparser to add the params to.
190
- """
191
- subparser.add_argument(*format.get_param_names(params.PARAM_SHORT), action='store_true')
191
+ #### Params:
192
+ - subparser (ArgumentParser): Subparser to add the params to.
193
+ """
194
+ subparser.add_argument(*format.get_param_names(params.PARAM_SHORT), action='store_true')
192
195
 
193
196
  def __get_default_job_number() -> int:
194
- """
195
- ### Gets the default number of jobs to be used by parallelizable tasks.
196
- Returned number will be 120% of CPU cores, due to not all jobs taking
197
- 100% of CPU time continuously.
198
-
199
- #### Returns:
200
- - (int): Default number of jobs.
201
- """
202
- return multiprocessing.cpu_count() + int(multiprocessing.cpu_count() * 0.2)
203
-
204
- def __get_project_root_subpath(subpath: str) -> str:
205
- """
206
- ### Returns a subpath of Xmipp's root directory.
207
-
208
- #### Params:
209
- - subpath (str): Subpath inside the root directory.
210
-
211
- #### Returns:
212
- - (str): Absolute path to given subpath.
213
- """
214
- return os.path.join(__get_project_root_dir(), subpath)
197
+ """
198
+ ### Gets the default number of jobs to be used by parallelizable tasks.
215
199
 
216
- def __get_project_root_dir() -> str:
217
- """
218
- ### Returns the root directory of Xmipp.
200
+ Returned number will be 120% of CPU cores, due to not all jobs taking
201
+ 100% of CPU time continuously.
219
202
 
220
- #### Returns:
221
- - (str): Absolute path to Xmipp's root directory.
222
- """
223
- return os.path.dirname(os.path.abspath(__file__))
203
+ #### Returns:
204
+ - (int): Default number of jobs.
205
+ """
206
+ return multiprocessing.cpu_count() + int(multiprocessing.cpu_count() * 0.2)
224
207
 
225
208
  def __add_default_usage_mode():
226
- """
227
- ### Sets the usage mode as the default one when a mode has not been specifically provided.
228
- """
229
- no_args_provided = len(sys.argv) == 1
230
- args_provided = len(sys.argv) > 1
231
- if no_args_provided or (
232
- args_provided and __is_first_arg_optional() and not __help_requested()
233
- ):
234
- sys.argv.insert(1, modes.MODE_ALL)
209
+ """### Sets the usage mode as the default one when a mode has not been specifically provided."""
210
+ no_args_provided = len(sys.argv) == 1
211
+ args_provided = len(sys.argv) > 1
212
+ if no_args_provided or (
213
+ args_provided and __is_first_arg_optional() and not __help_requested()
214
+ ):
215
+ sys.argv.insert(1, modes.MODE_ALL)
235
216
 
236
217
  def __is_first_arg_optional() -> bool:
237
- """
238
- ### Returns True if the first argument provided is optional.
218
+ """
219
+ ### Returns True if the first argument provided is optional.
239
220
 
240
- #### Returns:
241
- - (bool): True if the first argument received is optional.
242
- """
243
- return sys.argv[1].startswith('-')
221
+ #### Returns:
222
+ - (bool): True if the first argument received is optional.
223
+ """
224
+ return sys.argv[1].startswith('-')
244
225
 
245
226
  def __help_requested() -> bool:
246
- """
247
- ### Returns True if help is at least one of the args.
227
+ """
228
+ ### Returns True if help is at least one of the args.
248
229
 
249
- #### Returns:
250
- - (bool): True if help is at least one of the args.
251
- """
252
- return '-h' in sys.argv or '--help' in sys.argv
230
+ #### Returns:
231
+ - (bool): True if help is at least one of the args.
232
+ """
233
+ return '-h' in sys.argv or '--help' in sys.argv
253
234
 
254
235
  def __validate_args(args: Dict[str, Any], parser: argparse.ArgumentParser):
255
- """
256
- ### Performs validations on the arguments.
257
-
258
- #### Params:
259
- - args (dict(str, any)): Arguments to be validated.
260
- - parser (ArgumentParser): Argument parser.
261
- """
262
- jobs = args.get('jobs', 1)
263
- if jobs < 1:
264
- parser.error(f"Wrong job number \"{jobs}\". Number of jobs has to be 1 or greater.")
265
-
266
- branch = args.get('branch')
267
- if branch is not None and len(branch.split(' ')) > 1:
268
- parser.error(f"Incorrect branch name \"{branch}\". Branch names can only be one word long.")
269
-
270
- if args.get('keep_output', False):
271
- logger.set_allow_substitution(False)
236
+ """
237
+ ### Performs validations on the arguments.
238
+
239
+ #### Params:
240
+ - args (dict(str, any)): Arguments to be validated.
241
+ - parser (ArgumentParser): Argument parser.
242
+ """
243
+ jobs = args.get('jobs', 1)
244
+ if jobs < 1:
245
+ parser.error(f"Wrong job number \"{jobs}\". Number of jobs has to be 1 or greater.")
246
+
247
+ branch = args.get('branch')
248
+ if branch is not None and len(branch.split(' ')) > 1:
249
+ parser.error(f"Incorrect branch name \"{branch}\". Branch names can only be one word long.")
250
+
251
+ if args.get('keep_output', False):
252
+ logger.set_allow_substitution(False)