xmipp3-installer 1.0.1__py3-none-any.whl → 2.0.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 (61) 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 +138 -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/__init__.py +1 -2
  19. xmipp3_installer/installer/constants/paths.py +6 -0
  20. xmipp3_installer/installer/handlers/cmake/cmake_handler.py +49 -53
  21. xmipp3_installer/installer/handlers/conda_handler.py +6 -6
  22. xmipp3_installer/installer/handlers/generic_package_handler.py +9 -9
  23. xmipp3_installer/installer/handlers/git_handler.py +152 -153
  24. xmipp3_installer/installer/handlers/shell_handler.py +87 -88
  25. xmipp3_installer/installer/handlers/versions_manager.py +20 -6
  26. xmipp3_installer/installer/installer_service.py +22 -8
  27. xmipp3_installer/installer/modes/mode_all_executor.py +61 -51
  28. xmipp3_installer/installer/modes/mode_clean/mode_clean_all_executor.py +44 -36
  29. xmipp3_installer/installer/modes/mode_clean/mode_clean_bin_executor.py +84 -74
  30. xmipp3_installer/installer/modes/mode_clean/mode_clean_executor.py +48 -34
  31. xmipp3_installer/installer/modes/mode_cmake/mode_cmake_executor.py +60 -47
  32. xmipp3_installer/installer/modes/mode_cmake/mode_compile_and_install_executor.py +52 -39
  33. xmipp3_installer/installer/modes/mode_cmake/mode_config_build_executor.py +68 -49
  34. xmipp3_installer/installer/modes/mode_config_executor.py +44 -33
  35. xmipp3_installer/installer/modes/mode_executor.py +14 -13
  36. xmipp3_installer/installer/modes/mode_get_sources_executor.py +118 -112
  37. xmipp3_installer/installer/modes/mode_git_executor.py +43 -31
  38. xmipp3_installer/installer/modes/mode_selector.py +6 -0
  39. xmipp3_installer/installer/modes/mode_sync/mode_add_model_executor.py +97 -83
  40. xmipp3_installer/installer/modes/mode_sync/mode_get_models_executor.py +53 -41
  41. xmipp3_installer/installer/modes/mode_sync/mode_sync_executor.py +41 -35
  42. xmipp3_installer/installer/modes/mode_sync/mode_test_executor.py +144 -77
  43. xmipp3_installer/installer/modes/mode_version_executor.py +161 -150
  44. xmipp3_installer/installer/orquestrator.py +24 -24
  45. xmipp3_installer/installer/urls.py +4 -3
  46. xmipp3_installer/repository/config.py +225 -227
  47. xmipp3_installer/repository/config_vars/__init__.py +5 -0
  48. xmipp3_installer/repository/config_vars/config_values_adapter.py +97 -91
  49. xmipp3_installer/repository/config_vars/default_values.py +24 -24
  50. xmipp3_installer/repository/config_vars/variables.py +9 -9
  51. xmipp3_installer/repository/invalid_config_line.py +17 -0
  52. xmipp3_installer/shared/file_operations.py +14 -12
  53. xmipp3_installer/shared/singleton.py +16 -17
  54. xmipp3_installer-2.0.0.dist-info/METADATA +86 -0
  55. xmipp3_installer-2.0.0.dist-info/RECORD +70 -0
  56. {xmipp3_installer-1.0.1.dist-info → xmipp3_installer-2.0.0.dist-info}/WHEEL +1 -1
  57. xmipp3_installer-1.0.1.dist-info/METADATA +0 -729
  58. xmipp3_installer-1.0.1.dist-info/RECORD +0 -70
  59. {xmipp3_installer-1.0.1.dist-info → xmipp3_installer-2.0.0.dist-info}/entry_points.txt +0 -0
  60. /xmipp3_installer-1.0.1.dist-info/LICENSE → /xmipp3_installer-2.0.0.dist-info/licenses/LICENSE.txt +0 -0
  61. {xmipp3_installer-1.0.1.dist-info → xmipp3_installer-2.0.0.dist-info}/top_level.txt +0 -0
@@ -3,4 +3,4 @@
3
3
  from xmipp3_installer.application.cli.cli import main
4
4
 
5
5
  if __name__ == "__main__":
6
- main()
6
+ main()
@@ -9,42 +9,43 @@ from xmipp3_installer.installer import urls
9
9
  from xmipp3_installer.application.logger.logger import logger
10
10
 
11
11
  def send_installation_attempt(installation_info: Dict):
12
- """
13
- ### Sends a POST request to Xmipp's metrics's API.
14
-
15
- #### Params:
16
- - installation_info (dict): Dictionary containing all the installation information.
17
- """
18
- if installation_info is None:
19
- return
20
- params = json.dumps(installation_info)
21
- headers = {"Content-type": "application/json"}
22
- parsed_url = urlparse(urls.API_URL)
23
- conn = None
24
- try:
25
- conn = __get_https_connection(parsed_url, 2)
26
- conn.request("POST", parsed_url.path, body=params, headers=headers)
27
- conn.getresponse()
28
- except TimeoutError:
29
- logger(
30
- logger.yellow("There was a timeout while sending installation data."),
31
- show_in_terminal=False
32
- )
33
- finally:
34
- if conn is not None:
35
- conn.close()
12
+ """
13
+ ### Sends a POST request to Xmipp's metrics's API.
14
+
15
+ #### Params:
16
+ - installation_info (dict): Dictionary containing all the installation information.
17
+ """
18
+ if installation_info is None:
19
+ return
20
+ params = json.dumps(installation_info)
21
+ headers = {"Content-type": "application/json"}
22
+ parsed_url = urlparse(urls.API_URL)
23
+ conn = None
24
+ try:
25
+ conn = __get_https_connection(parsed_url, 6)
26
+ conn.request("POST", parsed_url.path, body=params, headers=headers)
27
+ conn.getresponse()
28
+ except TimeoutError:
29
+ logger(
30
+ logger.yellow("There was a timeout while sending installation data."),
31
+ show_in_terminal=False
32
+ )
33
+ finally:
34
+ if conn is not None:
35
+ conn.close()
36
36
 
37
37
 
38
38
  def __get_https_connection(parsed_url: ParseResult, timeout_seconds: int) -> http.client.HTTPSConnection:
39
- """
40
- ### Establishes the connection needed to send the API call.
41
- Separated to enable integration & E2E tests.
39
+ """
40
+ ### Establishes the connection needed to send the API call.
41
+
42
+ Separated to enable integration & E2E tests.
42
43
 
43
- #### Params:
44
- - parsed_url (ParseResult): Object containing all elements of the url.
45
- - timeout_seconds (int): Number of seconds to wait until a timeout.
44
+ #### Params:
45
+ - parsed_url (ParseResult): Object containing all elements of the url.
46
+ - timeout_seconds (int): Number of seconds to wait until a timeout.
46
47
 
47
- #### Returns:
48
- - (HTTPSConnection): Established connection.
49
- """
50
- return http.client.HTTPSConnection(parsed_url.hostname, parsed_url.port, timeout=timeout_seconds)
48
+ #### Returns:
49
+ - (HTTPSConnection): Established connection.
50
+ """
51
+ return http.client.HTTPSConnection(parsed_url.hostname or "localhost", parsed_url.port, timeout=timeout_seconds)
@@ -14,168 +14,161 @@ from xmipp3_installer.installer.constants import paths
14
14
  from xmipp3_installer.installer.handlers import shell_handler, git_handler, versions_manager
15
15
  from xmipp3_installer.installer.handlers.cmake import cmake_constants, cmake_handler
16
16
 
17
- def get_installation_info(version_manager: versions_manager.VersionsManager, ret_code: int=0) -> Optional[Dict]:
18
- """
19
- ### Creates a dictionary with the necessary data for the API POST message.
20
-
21
- #### Params:
22
- - version_manager (VersionsManager): Object containing all the version-related info.
23
- - ret_code (int): Optional. Return code for the API request.
24
-
25
- #### Return:
26
- - (dict | None): Dictionary with the required info or None if user id could not be produced.
27
- """
28
- library_versions = cmake_handler.get_library_versions_from_cmake_file(
29
- paths.LIBRARY_VERSIONS_FILE
30
- )
31
- environment_info = orquestrator.run_parallel_jobs(
32
- [
33
- __get_cpu_flags,
34
- git_handler.get_current_branch,
35
- git_handler.is_branch_up_to_date,
36
- __is_installed_by_scipion,
37
- __get_log_tail
38
- ],
39
- [(), (), (), (), ()]
40
- )
41
-
42
- return {
43
- "user": {
44
- "userId": __get_user_id()
45
- },
46
- "version": {
47
- "os": get_os_release_name(),
48
- "cpuFlags": environment_info[0],
49
- "cuda": library_versions.get(cmake_constants.CMAKE_CUDA),
50
- "cmake": library_versions.get(cmake_constants.CMAKE_CMAKE),
51
- "gcc": library_versions.get(cmake_constants.CMAKE_GCC),
52
- "gpp": library_versions.get(cmake_constants.CMAKE_GPP),
53
- "mpi": library_versions.get(cmake_constants.CMAKE_MPI),
54
- "python": library_versions.get(cmake_constants.CMAKE_PYTHON),
55
- "sqlite": library_versions.get(cmake_constants.CMAKE_SQLITE),
56
- "java": library_versions.get(cmake_constants.CMAKE_JAVA),
57
- "hdf5": library_versions.get(cmake_constants.CMAKE_HDF5),
58
- "jpeg": library_versions.get(cmake_constants.CMAKE_JPEG)
59
- },
60
- "xmipp": {
61
- "branch": __get_installation_branch_name(
62
- environment_info[1], version_manager
63
- ),
64
- "updated": environment_info[2],
65
- "installedByScipion": environment_info[3]
66
- },
67
- "returnCode": ret_code,
68
- "logTail": environment_info[4] if ret_code else None # Only needed if something went wrong
69
- }
17
+ def get_installation_info(version_manager: versions_manager.VersionsManager, ret_code: int=0) -> Dict:
18
+ """
19
+ ### Creates a dictionary with the necessary data for the API POST message.
20
+
21
+ #### Params:
22
+ - version_manager (VersionsManager): Object containing all the version-related info.
23
+ - ret_code (int): Optional. Return code for the API request.
24
+
25
+ #### Return:
26
+ - (dict): Dictionary with the required info.
27
+ """
28
+ library_versions = cmake_handler.get_library_versions_from_cmake_file(
29
+ paths.LIBRARY_VERSIONS_FILE
30
+ )
31
+ environment_info = orquestrator.run_parallel_jobs(
32
+ [
33
+ __get_cpu_flags,
34
+ git_handler.get_current_branch,
35
+ git_handler.is_branch_up_to_date,
36
+ __is_installed_by_scipion,
37
+ __get_log_tail
38
+ ],
39
+ [(), (), (), (), ()]
40
+ )
41
+
42
+ return {
43
+ "user": {
44
+ "userId": __get_user_id()
45
+ },
46
+ "version": {
47
+ "os": get_os_release_name(),
48
+ "cpuFlags": environment_info[0],
49
+ "cuda": library_versions.get(cmake_constants.CMAKE_CUDA),
50
+ "cmake": library_versions.get(cmake_constants.CMAKE_CMAKE),
51
+ "gcc": library_versions.get(cmake_constants.CMAKE_GCC),
52
+ "gpp": library_versions.get(cmake_constants.CMAKE_GPP),
53
+ "mpi": library_versions.get(cmake_constants.CMAKE_MPI),
54
+ "python": library_versions.get(cmake_constants.CMAKE_PYTHON),
55
+ "sqlite": library_versions.get(cmake_constants.CMAKE_SQLITE),
56
+ "java": library_versions.get(cmake_constants.CMAKE_JAVA),
57
+ "hdf5": library_versions.get(cmake_constants.CMAKE_HDF5),
58
+ "jpeg": library_versions.get(cmake_constants.CMAKE_JPEG)
59
+ },
60
+ "xmipp": {
61
+ "branch": __get_installation_branch_name(
62
+ environment_info[1], version_manager
63
+ ),
64
+ "updated": environment_info[2],
65
+ "installedByScipion": environment_info[3]
66
+ },
67
+ "returnCode": ret_code,
68
+ "logTail": environment_info[4] if ret_code else None # Only needed if something went wrong
69
+ }
70
70
 
71
71
  def get_os_release_name() -> str:
72
- """
73
- ### Returns the name of the current system OS release.
72
+ """
73
+ ### Returns the name of the current system OS release.
74
74
 
75
- #### Returns:
76
- - (str): OS release name.
77
- """
78
- platform_system = platform.system()
79
- if platform_system == "Linux":
80
- return f"{distro.name()} {distro.version()}"
81
- return f"{platform_system} {platform.release()}"
75
+ #### Returns:
76
+ - (str): OS release name.
77
+ """
78
+ platform_system = platform.system()
79
+ if platform_system == "Linux":
80
+ return f"{distro.name()} {distro.version()}"
81
+ return f"{platform_system} {platform.release()}"
82
82
 
83
83
  def __get_installation_branch_name(branch_name: str, version_manager: versions_manager.VersionsManager) -> str:
84
- """
85
- ### Returns the branch or release name of Xmipp.
84
+ """
85
+ ### Returns the branch or release name of Xmipp.
86
86
 
87
- #### Params:
88
- - branch_name (str): Retrieved branch name.
89
- - version_manager (VersionsManager): Object containing all the version-related info.
87
+ #### Params:
88
+ - branch_name (str): Retrieved branch name.
89
+ - version_manager (VersionsManager): Object containing all the version-related info.
90
90
 
91
- #### Return:
92
- - (str): Release name if Xmipp is in a release branch, or the branch name otherwise.
93
- """
94
- if not branch_name or branch_name == constants.MASTER_BRANCHNAME:
95
- return version_manager.xmipp_version_number
96
- return branch_name
91
+ #### Return:
92
+ - (str): Release name if Xmipp is in a release branch, or the branch name otherwise.
93
+ """
94
+ return branch_name or version_manager.xmipp_version_number
97
95
 
98
96
  def __get_user_id() -> str:
99
- """
100
- ### Returns the unique user id for this machine.
101
-
102
- #### Returns:
103
- - (str): User id, or 'Anoymous' if there were any errors.
104
- """
105
- identifier = __get_mac_address()
106
- if not identifier:
107
- identifier = getpass.getuser()
108
- if not identifier:
109
- return "Anonymous"
110
-
111
- sha256 = hashlib.sha256()
112
- sha256.update(identifier.encode())
113
- return sha256.hexdigest()
97
+ """
98
+ ### Returns the unique user id for this machine.
99
+
100
+ #### Returns:
101
+ - (str): User id, or 'Anoymous' if there were any errors.
102
+ """
103
+ identifier = __get_mac_address()
104
+ if not identifier:
105
+ identifier = getpass.getuser()
106
+ if not identifier:
107
+ return "Anonymous"
108
+
109
+ sha256 = hashlib.sha256()
110
+ sha256.update(identifier.encode())
111
+ return sha256.hexdigest()
114
112
 
115
113
  def __get_cpu_flags() -> List[str]:
116
- """
117
- ### This function obtains the list of compilation flags supported by the CPU.
118
-
119
- #### Returns:
120
- - (list(str)): List of flags supported by the CPU.
121
- """
122
- flags_header = "Flags:"
123
- ret_code, flags_line = shell_handler.run_shell_command(f'lscpu | grep \"{flags_header}\"')
124
- if ret_code:
125
- return []
126
- flags_line = flags_line.replace(flags_header, "").strip()
127
- return [flag for flag in flags_line.split(" ") if flag]
114
+ """
115
+ ### This function obtains the list of compilation flags supported by the CPU.
116
+
117
+ #### Returns:
118
+ - (list(str)): List of flags supported by the CPU.
119
+ """
120
+ flags_header = "Flags:"
121
+ ret_code, flags_line = shell_handler.run_shell_command(f'lscpu | grep \"{flags_header}\"')
122
+ if ret_code:
123
+ return []
124
+ flags_line = flags_line.replace(flags_header, "").strip()
125
+ return [flag for flag in flags_line.split(" ") if flag]
128
126
 
129
127
  def __get_log_tail() -> Optional[str]:
130
- """
131
- ### Returns the last lines of the installation log.
132
-
133
- #### Returns:
134
- - (str | None): Installation log's last lines, or None if there were any errors.
135
- """
136
- ret_code, output = shell_handler.run_shell_command(
137
- f"tail -n {constants.TAIL_LOG_NCHARS} {paths.LOG_FILE}"
138
- )
139
- return output if ret_code == 0 else None
128
+ """
129
+ ### Returns the last lines of the installation log.
130
+
131
+ #### Returns:
132
+ - (str | None): Installation log's last lines, or None if there were any errors.
133
+ """
134
+ ret_code, output = shell_handler.run_shell_command(
135
+ f"tail -n {constants.TAIL_LOG_NCHARS} {paths.LOG_FILE}"
136
+ )
137
+ return output if ret_code == 0 else None
140
138
 
141
139
  def __get_mac_address() -> Optional[str]:
142
- """
143
- ### Returns a physical MAC address for this machine. It prioritizes ethernet over wireless.
144
-
145
- #### Returns:
146
- - (str | None): MAC address, or None if there were any errors.
147
- """
148
- ret_code, output = shell_handler.run_shell_command("ip addr")
149
- return __find_mac_address_in_lines(output.split('\n')) if ret_code == 0 else None
140
+ """
141
+ ### Returns a physical MAC address for this machine. It prioritizes ethernet over wireless.
142
+
143
+ #### Returns:
144
+ - (str | None): MAC address, or None if there were any errors.
145
+ """
146
+ ret_code, output = shell_handler.run_shell_command("ip addr")
147
+ return __find_mac_address_in_lines(output.split('\n')) if ret_code == 0 else None
150
148
 
151
149
  def __find_mac_address_in_lines(lines: List[str]) -> Optional[str]:
152
- """
153
- ### Returns a physical MAC address within the text lines provided.
154
-
155
- #### Params:
156
- - lines (list(str)): Lines of text where MAC address should be looked for.
157
-
158
- #### Returns:
159
- - (str | None): MAC address if found, None otherwise.
160
- """
161
- for line_index in range(len(lines) - 1):
162
- line = lines[line_index]
163
- match = re.match(r"^\d+: (enp|wlp|eth|ens|eno)\w+", line)
164
- if not match:
165
- continue
166
- interface_name = match.group(1)
167
- if interface_name.startswith(('enp', 'wlp', 'eth', 'ens', 'eno')):
168
- return re.search(
169
- r"link/ether ([0-9a-f:]{17})",
170
- lines[line_index + 1]
171
- ).group(1)
172
- return None
150
+ """
151
+ ### Returns a physical MAC address within the text lines provided.
152
+
153
+ #### Params:
154
+ - lines (list(str)): Lines of text where MAC address should be looked for.
155
+
156
+ #### Returns:
157
+ - (str | None): MAC address if found, None otherwise.
158
+ """
159
+ for line_index in range(len(lines) - 1):
160
+ match = re.match(r"^\d+: (enp|wlp|eth|ens|eno)\w+", lines[line_index])
161
+ if not match:
162
+ continue
163
+ mac_match = re.search(r"link/ether ([0-9a-f:]{17})", lines[line_index + 1])
164
+ if mac_match:
165
+ return mac_match.group(1)
173
166
 
174
167
  def __is_installed_by_scipion() -> bool:
175
- """
176
- ### Checks if the current xmipp installation is being carried out from Scipion.
168
+ """
169
+ ### Checks if the current xmipp installation is being carried out from Scipion.
177
170
 
178
- #### Returns:
179
- - (bool): True if the installation is executed by Scipion, False otherwise.
180
- """
181
- return bool(os.getenv("SCIPION_SOFTWARE"))
171
+ #### Returns:
172
+ - (bool): True if the installation is executed by Scipion, False otherwise.
173
+ """
174
+ return bool(os.getenv("SCIPION_SOFTWARE"))
@@ -1,8 +1,9 @@
1
1
  """### Containis all common constants needed for the argument parsing part of Xmipp's installation."""
2
2
 
3
+ from xmipp3_installer.installer.constants import paths
4
+
3
5
  XMIPP_PROGRAM_NAME = "xmipp"
4
6
 
5
7
  # Other variables
6
8
  COMMON_USAGE_HELP_MESSAGE = 'Run \"./xmipp -h\" for usage help.'
7
- DEFAULT_BUILD_DIR = 'build'
8
- DEFAULT_MODELS_DIR = DEFAULT_BUILD_DIR
9
+ DEFAULT_MODELS_DIR = paths.INSTALL_PATH
@@ -4,8 +4,10 @@ from xmipp3_installer.application.cli import arguments
4
4
  from xmipp3_installer.application.cli.arguments.params import (
5
5
  PARAM_SHORT, PARAM_JOBS, PARAM_BRANCH, PARAM_KEEP_OUTPUT, PARAM_OVERWRITE,
6
6
  PARAM_MODELS_DIRECTORY, PARAM_TEST_NAMES, PARAM_SHOW_TESTS, PARAM_GIT_COMMAND,
7
- PARAM_LOGIN, PARAM_MODEL_PATH, PARAM_UPDATE, PARAMS, SHORT_VERSION, LONG_VERSION
7
+ PARAM_LOGIN, PARAM_MODEL_PATH, PARAM_UPDATE, PARAMS, PARAM_ALL_FUNCTIONS,
8
+ PARAM_ALL_PROGRAMS, SHORT_VERSION, LONG_VERSION
8
9
  )
10
+ from xmipp3_installer.installer import urls, constants
9
11
 
10
12
  MODE = "mode"
11
13
 
@@ -25,106 +27,121 @@ MODE_VERSION = 'version'
25
27
 
26
28
  # Modes with help message
27
29
  MODES = {
28
- 'General': {
29
- MODE_VERSION: ['Returns the version information. Add \'--short\' to print only the version number.'],
30
- MODE_COMPILE_AND_INSTALL: ['Compiles and installs Xmipp based on already obtained sources.'],
31
- MODE_ALL: [f'Default param. Runs {MODE_CONFIG}, {MODE_CONFIG_BUILD}, and {MODE_COMPILE_AND_INSTALL}.'],
32
- MODE_CONFIG_BUILD: ['Configures the project with CMake.']
33
- },
34
- 'Config': {
35
- MODE_CONFIG: ['Generates a config file template with default values.'],
36
- },
37
- 'Downloads': {
38
- MODE_GET_MODELS: [f'Download the DeepLearning Models at dir/models ({arguments.DEFAULT_MODELS_DIR} by default).'],
39
- MODE_GET_SOURCES: ['Clone all Xmipp\'s sources.']
40
- },
41
- 'Clean': {
42
- MODE_CLEAN_BIN: ['Removes all compiled binaries.'],
43
- MODE_CLEAN_ALL: ['Removes all compiled binaries and sources, leaves the repository as if freshly cloned (without pulling).']
44
- },
45
- 'Test': {
46
- MODE_TEST: ['Runs a given test.']
47
- },
48
- 'Developers': {
49
- MODE_GIT: ['Runs the given git action for all source repositories.'],
50
- MODE_ADD_MODEL: [
51
- "Takes a DeepLearning model from the modelPath, makes a tgz of it and uploads the .tgz according to the <login>.",
52
- "This mode is used to upload a model folder to the Scipion/Xmipp server.",
53
- "Usually the model folder contains big files used to fed deep learning procedures"
54
- "with pretrained data. All the models stored in the server will be downloads"
55
- "using the 'get_models' mode or during the compilation/installation time"
56
- "or with scipion3 installb deepLearningToolkit modelsPath must be the absolute path.",
57
- "",
58
- "Usage: -> ./xmipp addModel <usr@server> <modelsPath> [--update]",
59
- "Steps: 0. modelName = basename(modelsPath) <- Please, check the folders name!",
60
- " 1. Packing in 'xmipp_model_modelName.tgz'",
61
- " 2. Check if that model already exists (use --update to override an existing model)",
62
- " 3. Upload the model to the server.",
63
- " 4. Update the MANIFEST file.",
64
- "",
65
- "The model name will be the folder name in <modelsPath>",
66
- "Must have write permisions to such machine."
67
- ]
68
- }
30
+ 'General': {
31
+ MODE_VERSION: ['Returns the version information. Add \'--short\' to print only the version number.'],
32
+ MODE_COMPILE_AND_INSTALL: ['Compiles and installs Xmipp based on already obtained sources.'],
33
+ MODE_ALL: [f'Default param. Runs {MODE_CONFIG}, {MODE_CONFIG_BUILD}, and {MODE_COMPILE_AND_INSTALL}.'],
34
+ MODE_CONFIG_BUILD: ['Configures the project with CMake.']
35
+ },
36
+ 'Config': {
37
+ MODE_CONFIG: ['Generates a config file template with default values.'],
38
+ },
39
+ 'Downloads': {
40
+ MODE_GET_MODELS: [
41
+ f'Downloads the Deep Learning Models required by the DLTK tools at dir/models ({arguments.DEFAULT_MODELS_DIR} by default).',
42
+ f'Visit {urls.DLTK_DOCS_URL} for more details.'
43
+ ],
44
+ MODE_GET_SOURCES: [f'Clones Xmipp\'s source repositories {constants.XMIPP_CORE} & {constants.XMIPP_VIZ}.']
45
+ },
46
+ 'Clean': {
47
+ MODE_CLEAN_BIN: ['Removes all compiled binaries.'],
48
+ MODE_CLEAN_ALL: ['Removes all compiled binaries and sources, leaves the repository as if freshly cloned (without pulling).']
49
+ },
50
+ 'Test': {
51
+ MODE_TEST: [
52
+ 'Runs Xmipp\'s tests.',
53
+ f'If used with \'{PARAMS[PARAM_TEST_NAMES][SHORT_VERSION]}\', only the tests provided will run.',
54
+ f'If used with \'{PARAMS[PARAM_SHOW_TESTS][LONG_VERSION]}\', a list the tests available and how to invoke them will be shown.',
55
+ f'If used with \'{PARAMS[PARAM_ALL_FUNCTIONS][LONG_VERSION]}\', all function tests will run.',
56
+ f'If used with \'{PARAMS[PARAM_ALL_PROGRAMS][LONG_VERSION]}\', all program tests will run.'
57
+ ]
58
+ },
59
+ 'Developers': {
60
+ MODE_GIT: ['Runs the given git action for all source repositories.'],
61
+ MODE_ADD_MODEL: [
62
+ "Takes a DeepLearning model from the modelPath, makes a tgz of it and uploads the .tgz according to the <login>.",
63
+ "This mode is used to upload a model folder to the Scipion/Xmipp server.",
64
+ "Usually the model folder contains big files used to feed deep learning procedures "
65
+ "with pretrained data. All the models stored in the server will be downloaded "
66
+ "using the 'get_models' mode, during the compilation/installation time, "
67
+ "or with scipion3 installb deepLearningToolkit.",
68
+ "Param <modelsPath> must be an absolute path.",
69
+ "",
70
+ "Usage: -> ./xmipp addModel <usr@server> <modelsPath> [--update]",
71
+ "Steps: 0. modelName = basename(modelsPath) <- Please, check the folders name!",
72
+ " 1. Packing in 'xmipp_model_modelName.tgz'",
73
+ " 2. Check if that model already exists (use --update to override an existing model)",
74
+ " 3. Upload the model to the server.",
75
+ " 4. Update the MANIFEST file.",
76
+ "",
77
+ "The model name will be the folder name in <modelsPath>",
78
+ "Must have write permissions to such machine."
79
+ ]
80
+ }
69
81
  }
70
82
 
71
83
  # Arguments of each mode, sorted by group
84
+ # Inside each mode, params are grouped by mutually exclusive groups
85
+ # For example: MYMODE: [[PARAM1, PARAM2], [PARAM3, PARAM4]] would translate to
86
+ # "mymode ([param1] [param2] | [param3] [param4])" in the general help message
72
87
  MODE_ARGS = {
73
- MODE_VERSION: [PARAM_SHORT],
74
- MODE_COMPILE_AND_INSTALL: [PARAM_JOBS, PARAM_KEEP_OUTPUT],
75
- MODE_ALL: [PARAM_JOBS, PARAM_BRANCH, PARAM_KEEP_OUTPUT],
76
- MODE_CONFIG_BUILD: [PARAM_KEEP_OUTPUT],
77
- MODE_CONFIG: [PARAM_OVERWRITE],
78
- MODE_GET_MODELS: [PARAM_MODELS_DIRECTORY],
79
- MODE_GET_SOURCES: [PARAM_BRANCH, PARAM_KEEP_OUTPUT],
80
- MODE_CLEAN_BIN: [],
81
- MODE_CLEAN_ALL: [],
82
- MODE_TEST: [PARAM_TEST_NAMES, PARAM_SHOW_TESTS],
83
- MODE_GIT: [PARAM_GIT_COMMAND],
84
- MODE_ADD_MODEL: [PARAM_LOGIN, PARAM_MODEL_PATH, PARAM_UPDATE]
88
+ MODE_VERSION: [PARAM_SHORT],
89
+ MODE_COMPILE_AND_INSTALL: [PARAM_JOBS, PARAM_KEEP_OUTPUT],
90
+ MODE_ALL: [PARAM_JOBS, PARAM_BRANCH, PARAM_KEEP_OUTPUT],
91
+ MODE_CONFIG_BUILD: [PARAM_KEEP_OUTPUT],
92
+ MODE_CONFIG: [PARAM_OVERWRITE],
93
+ MODE_GET_MODELS: [PARAM_MODELS_DIRECTORY],
94
+ MODE_GET_SOURCES: [PARAM_BRANCH, PARAM_KEEP_OUTPUT],
95
+ MODE_CLEAN_BIN: [],
96
+ MODE_CLEAN_ALL: [],
97
+ MODE_TEST: [[PARAM_TEST_NAMES], [PARAM_SHOW_TESTS], [PARAM_ALL_FUNCTIONS], [PARAM_ALL_PROGRAMS]],
98
+ MODE_GIT: [PARAM_GIT_COMMAND],
99
+ MODE_ADD_MODEL: [PARAM_LOGIN, PARAM_MODEL_PATH, PARAM_UPDATE]
85
100
  }
86
101
 
87
102
  # Examples for the help message of each mode
88
103
  MODE_EXAMPLES = {
89
- MODE_VERSION: [
90
- f'./xmipp {MODE_VERSION}',
91
- f'./xmipp {MODE_VERSION} {PARAMS[PARAM_SHORT][LONG_VERSION]}',
92
- ],
93
- MODE_COMPILE_AND_INSTALL: [
94
- f'./xmipp {MODE_COMPILE_AND_INSTALL}',
95
- f'./xmipp {MODE_COMPILE_AND_INSTALL} {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20',
96
- ],
97
- MODE_ALL: [
98
- './xmipp',
99
- f'./xmipp {MODE_ALL}',
100
- f'./xmipp {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20',
101
- f'./xmipp {PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel',
102
- f'./xmipp {MODE_ALL} {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20 '
103
- f'{PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel'
104
- ],
105
- MODE_CONFIG_BUILD: [],
106
- MODE_CONFIG: [
107
- f'./xmipp {MODE_CONFIG} {PARAMS[PARAM_OVERWRITE][LONG_VERSION]}'
108
- ],
109
- MODE_GET_MODELS: [
110
- f'./xmipp {MODE_GET_MODELS}',
111
- f'./xmipp {MODE_GET_MODELS} {PARAMS[PARAM_MODELS_DIRECTORY][SHORT_VERSION]} /path/to/my/model/directory'
112
- ],
113
- MODE_GET_SOURCES: [
114
- f'./xmipp {MODE_GET_SOURCES}'
115
- f'./xmipp {MODE_GET_SOURCES} {PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel'
116
- ],
117
- MODE_CLEAN_BIN: [],
118
- MODE_CLEAN_ALL: [],
119
- MODE_TEST: [
120
- f'./xmipp {MODE_TEST} xmipp_sample_test',
121
- f'./xmipp {MODE_TEST} {PARAMS[PARAM_SHORT][LONG_VERSION]}',
122
- ],
123
- MODE_GIT: [
124
- f'./xmipp {MODE_GIT} pull',
125
- f'./xmipp {MODE_GIT} checkout devel'
126
- ],
127
- MODE_ADD_MODEL: [
128
- f'./xmipp {MODE_ADD_MODEL} myuser@127.0.0.1 /home/myuser/mymodel'
129
- ]
104
+ MODE_VERSION: [
105
+ f'./xmipp {MODE_VERSION}',
106
+ f'./xmipp {MODE_VERSION} {PARAMS[PARAM_SHORT][LONG_VERSION]}',
107
+ ],
108
+ MODE_COMPILE_AND_INSTALL: [
109
+ f'./xmipp {MODE_COMPILE_AND_INSTALL}',
110
+ f'./xmipp {MODE_COMPILE_AND_INSTALL} {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20',
111
+ ],
112
+ MODE_ALL: [
113
+ './xmipp',
114
+ f'./xmipp {MODE_ALL}',
115
+ f'./xmipp {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20',
116
+ f'./xmipp {PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel',
117
+ f'./xmipp {MODE_ALL} {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20 '
118
+ f'{PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel'
119
+ ],
120
+ MODE_CONFIG_BUILD: [],
121
+ MODE_CONFIG: [
122
+ f'./xmipp {MODE_CONFIG} {PARAMS[PARAM_OVERWRITE][LONG_VERSION]}'
123
+ ],
124
+ MODE_GET_MODELS: [
125
+ f'./xmipp {MODE_GET_MODELS}',
126
+ f'./xmipp {MODE_GET_MODELS} {PARAMS[PARAM_MODELS_DIRECTORY][SHORT_VERSION]} /path/to/my/model/directory'
127
+ ],
128
+ MODE_GET_SOURCES: [
129
+ f'./xmipp {MODE_GET_SOURCES}'
130
+ f'./xmipp {MODE_GET_SOURCES} {PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel'
131
+ ],
132
+ MODE_CLEAN_BIN: [],
133
+ MODE_CLEAN_ALL: [],
134
+ MODE_TEST: [
135
+ f'./xmipp {MODE_TEST} xmipp_sample_test',
136
+ f'./xmipp {MODE_TEST} {PARAMS[PARAM_SHOW_TESTS][LONG_VERSION]}',
137
+ f'./xmipp {MODE_TEST} {PARAMS[PARAM_ALL_FUNCTIONS][LONG_VERSION]}',
138
+ f'./xmipp {MODE_TEST} {PARAMS[PARAM_ALL_PROGRAMS][LONG_VERSION]}'
139
+ ],
140
+ MODE_GIT: [
141
+ f'./xmipp {MODE_GIT} pull',
142
+ f'./xmipp {MODE_GIT} checkout devel'
143
+ ],
144
+ MODE_ADD_MODEL: [
145
+ f'./xmipp {MODE_ADD_MODEL} myuser@127.0.0.1 /home/myuser/mymodel'
146
+ ]
130
147
  }