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.
- xmipp3_installer/__main__.py +1 -1
- xmipp3_installer/api_client/api_client.py +35 -34
- xmipp3_installer/api_client/assembler/installation_info_assembler.py +140 -145
- xmipp3_installer/application/cli/arguments/__init__.py +3 -2
- xmipp3_installer/application/cli/arguments/modes.py +112 -95
- xmipp3_installer/application/cli/arguments/params.py +63 -53
- xmipp3_installer/application/cli/cli.py +171 -190
- xmipp3_installer/application/cli/parsers/base_help_formatter.py +256 -235
- xmipp3_installer/application/cli/parsers/error_handler_parser.py +53 -53
- xmipp3_installer/application/cli/parsers/format.py +22 -22
- xmipp3_installer/application/cli/parsers/general_help_formatter.py +102 -84
- xmipp3_installer/application/cli/parsers/mode_help_formatter.py +144 -105
- xmipp3_installer/application/logger/__init__.py +5 -0
- xmipp3_installer/application/logger/errors.py +8 -8
- xmipp3_installer/application/logger/logger.py +218 -215
- xmipp3_installer/application/logger/predefined_messages.py +42 -35
- xmipp3_installer/application/user_interactions.py +6 -0
- xmipp3_installer/installer/constants/paths.py +6 -1
- xmipp3_installer/installer/handlers/cmake/cmake_handler.py +49 -53
- xmipp3_installer/installer/handlers/conda_handler.py +6 -6
- xmipp3_installer/installer/handlers/generic_package_handler.py +9 -9
- xmipp3_installer/installer/handlers/git_handler.py +152 -153
- xmipp3_installer/installer/handlers/shell_handler.py +87 -88
- xmipp3_installer/installer/handlers/versions_manager.py +20 -6
- xmipp3_installer/installer/installer_service.py +22 -8
- xmipp3_installer/installer/modes/mode_all_executor.py +61 -51
- xmipp3_installer/installer/modes/mode_clean/mode_clean_all_executor.py +44 -36
- xmipp3_installer/installer/modes/mode_clean/mode_clean_bin_executor.py +84 -74
- xmipp3_installer/installer/modes/mode_clean/mode_clean_executor.py +48 -34
- xmipp3_installer/installer/modes/mode_cmake/mode_cmake_executor.py +60 -47
- xmipp3_installer/installer/modes/mode_cmake/mode_compile_and_install_executor.py +52 -39
- xmipp3_installer/installer/modes/mode_cmake/mode_config_build_executor.py +68 -49
- xmipp3_installer/installer/modes/mode_config_executor.py +44 -33
- xmipp3_installer/installer/modes/mode_executor.py +14 -13
- xmipp3_installer/installer/modes/mode_get_sources_executor.py +121 -112
- xmipp3_installer/installer/modes/mode_git_executor.py +43 -31
- xmipp3_installer/installer/modes/mode_selector.py +6 -0
- xmipp3_installer/installer/modes/mode_sync/mode_add_model_executor.py +97 -83
- xmipp3_installer/installer/modes/mode_sync/mode_get_models_executor.py +53 -41
- xmipp3_installer/installer/modes/mode_sync/mode_sync_executor.py +41 -35
- xmipp3_installer/installer/modes/mode_sync/mode_test_executor.py +144 -77
- xmipp3_installer/installer/modes/mode_version_executor.py +161 -150
- xmipp3_installer/installer/orquestrator.py +24 -24
- xmipp3_installer/installer/urls.py +4 -3
- xmipp3_installer/repository/config.py +225 -227
- xmipp3_installer/repository/config_vars/__init__.py +5 -0
- xmipp3_installer/repository/config_vars/config_values_adapter.py +97 -91
- xmipp3_installer/repository/config_vars/default_values.py +24 -24
- xmipp3_installer/repository/config_vars/variables.py +9 -9
- xmipp3_installer/repository/invalid_config_line.py +17 -0
- xmipp3_installer/shared/file_operations.py +14 -12
- xmipp3_installer/shared/singleton.py +16 -17
- xmipp3_installer-1.1.0.dist-info/METADATA +86 -0
- xmipp3_installer-1.1.0.dist-info/RECORD +70 -0
- {xmipp3_installer-1.0.0.dist-info → xmipp3_installer-1.1.0.dist-info}/WHEEL +1 -1
- xmipp3_installer-1.0.0.dist-info/METADATA +0 -729
- xmipp3_installer-1.0.0.dist-info/RECORD +0 -70
- {xmipp3_installer-1.0.0.dist-info → xmipp3_installer-1.1.0.dist-info}/entry_points.txt +0 -0
- /xmipp3_installer-1.0.0.dist-info/LICENSE → /xmipp3_installer-1.1.0.dist-info/licenses/LICENSE.txt +0 -0
- {xmipp3_installer-1.0.0.dist-info → xmipp3_installer-1.1.0.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
"""
|
|
2
|
+
### Mode Version Executor Module.
|
|
3
|
+
|
|
4
|
+
This module contains the class to collect and display version information.
|
|
5
|
+
"""
|
|
1
6
|
import os
|
|
2
7
|
from typing import Dict, Tuple
|
|
3
8
|
|
|
@@ -12,153 +17,159 @@ from xmipp3_installer.installer.handlers.cmake import cmake_handler
|
|
|
12
17
|
from xmipp3_installer.repository.config_vars import variables
|
|
13
18
|
|
|
14
19
|
class ModeVersionExecutor(mode_executor.ModeExecutor):
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
20
|
+
"""
|
|
21
|
+
### Mode Version Executor.
|
|
22
|
+
|
|
23
|
+
Collects and displays version information for the installation.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
__LEFT_TEXT_LEN = 25
|
|
27
|
+
|
|
28
|
+
def __init__(self, context: Dict):
|
|
29
|
+
"""
|
|
30
|
+
### Constructor.
|
|
31
|
+
|
|
32
|
+
#### Params:
|
|
33
|
+
- context (dict): Dictionary containing the installation context variables.
|
|
34
|
+
"""
|
|
35
|
+
super().__init__(context)
|
|
36
|
+
self.short = context.pop(params.PARAM_SHORT)
|
|
37
|
+
config_exists = os.path.exists(paths.CONFIG_FILE)
|
|
38
|
+
self.version_file_exists = os.path.exists(paths.LIBRARY_VERSIONS_FILE)
|
|
39
|
+
self.is_configured = config_exists and self.version_file_exists
|
|
40
|
+
versions: versions_manager.VersionsManager = context[constants.VERSIONS_CONTEXT_KEY]
|
|
41
|
+
self.xmipp_version_number = versions.xmipp_version_number
|
|
42
|
+
self.xmipp_version_name = versions.xmipp_version_name
|
|
43
|
+
self.release_date = versions.xmipp_release_date
|
|
44
|
+
|
|
45
|
+
def run(self) -> Tuple[int, str]:
|
|
46
|
+
"""
|
|
47
|
+
### Collects all the version information available and displays it.
|
|
48
|
+
|
|
49
|
+
#### Returns:
|
|
50
|
+
- (tuple(int, str)): Tuple containing the error status and an error message if there was an error.
|
|
51
|
+
"""
|
|
52
|
+
installation_info = self.xmipp_version_name if self.short else self.__get_long_version()
|
|
53
|
+
logger(installation_info)
|
|
54
|
+
return 0, ""
|
|
55
|
+
|
|
56
|
+
def __get_long_version(self) -> str:
|
|
57
|
+
"""
|
|
58
|
+
### Returns the long version of the installation info.
|
|
59
|
+
|
|
60
|
+
#### Returns:
|
|
61
|
+
- (str): Long version of the installation info.
|
|
62
|
+
"""
|
|
63
|
+
installation_info_lines = []
|
|
64
|
+
version_type = 'release' if git_handler.is_tag() else git_handler.get_current_branch()
|
|
65
|
+
title = f"Xmipp {self.xmipp_version_number} ({version_type})"
|
|
66
|
+
installation_info_lines.append(f"{logger.bold(title)}\n")
|
|
67
|
+
installation_info_lines.append(self.__get_dates_section())
|
|
68
|
+
system_version_left_text = self.__add_padding_spaces("System version: ")
|
|
69
|
+
installation_info_lines.append(f"{system_version_left_text}{installation_info_assembler.get_os_release_name()}")
|
|
70
|
+
installation_info_lines.append(self.__get_sources_info())
|
|
71
|
+
if self.version_file_exists:
|
|
72
|
+
installation_info_lines.append(f"\n{self.__get_library_versions_section()}")
|
|
73
|
+
if not self.is_configured or not _are_all_sources_present():
|
|
74
|
+
installation_info_lines.append(f"\n{_get_configuration_warning_message()}")
|
|
75
|
+
return '\n'.join(installation_info_lines)
|
|
76
|
+
|
|
77
|
+
def __get_dates_section(self) -> str:
|
|
78
|
+
"""
|
|
79
|
+
### Returns the message section related to dates.
|
|
80
|
+
|
|
81
|
+
#### Returns:
|
|
82
|
+
- (str): Dates related message section.
|
|
83
|
+
"""
|
|
84
|
+
dates_section = f"{self.__add_padding_spaces('Release date: ')}{self.release_date}\n"
|
|
85
|
+
dates_section += f"{self.__add_padding_spaces('Compilation date: ')}"
|
|
86
|
+
last_modified = self.context.get(variables.LAST_MODIFIED_KEY)
|
|
87
|
+
dates_section += last_modified if last_modified else '-'
|
|
88
|
+
return dates_section
|
|
89
|
+
|
|
90
|
+
def __get_sources_info(self) -> str:
|
|
91
|
+
"""
|
|
92
|
+
### Returns the message section related to sources.
|
|
93
|
+
|
|
94
|
+
#### Returns:
|
|
95
|
+
- (str): Sources related message section.
|
|
96
|
+
"""
|
|
97
|
+
sources_message_lines = []
|
|
98
|
+
for source_package in constants.XMIPP_SOURCES:
|
|
99
|
+
sources_message_lines.append(self.__get_source_info(source_package))
|
|
100
|
+
return '\n'.join(sources_message_lines)
|
|
101
|
+
|
|
102
|
+
def __get_source_info(self, source: str) -> str:
|
|
103
|
+
"""
|
|
104
|
+
### Returns the info message related to a given source.
|
|
105
|
+
|
|
106
|
+
#### Params:
|
|
107
|
+
- source (str): Source to get the message about.
|
|
108
|
+
|
|
109
|
+
#### Returns:
|
|
110
|
+
- (str): Info message about the given source.
|
|
111
|
+
"""
|
|
112
|
+
source_path = paths.get_source_path(source)
|
|
113
|
+
source_left_text = self.__add_padding_spaces(f"{source} branch: ")
|
|
114
|
+
if not os.path.exists(source_path):
|
|
115
|
+
return f"{source_left_text}{logger.yellow('Not found')}"
|
|
116
|
+
current_commit = git_handler.get_current_commit(dir=source_path)
|
|
117
|
+
commit_branch = git_handler.get_commit_branch(current_commit, dir=source_path)
|
|
118
|
+
current_branch = git_handler.get_current_branch(dir=source_path)
|
|
119
|
+
display_name = commit_branch if git_handler.is_tag(dir=source_path) else current_branch
|
|
120
|
+
return f"{source_left_text}{display_name} ({current_commit})"
|
|
121
|
+
|
|
122
|
+
def __add_padding_spaces(self, left_text: str) -> str:
|
|
123
|
+
"""
|
|
124
|
+
### Adds right padding as spaces to the given text until it reaches the desired length.
|
|
125
|
+
|
|
126
|
+
#### Params:
|
|
127
|
+
- left_text (str): Text to add padding to.
|
|
128
|
+
|
|
129
|
+
#### Returns:
|
|
130
|
+
- (str): Padded string.
|
|
131
|
+
"""
|
|
132
|
+
text_len = len(left_text)
|
|
133
|
+
if text_len >= self.__LEFT_TEXT_LEN:
|
|
134
|
+
return left_text
|
|
135
|
+
spaces = ''.join([' ' for _ in range(self.__LEFT_TEXT_LEN - text_len)])
|
|
136
|
+
return f"{left_text}{spaces}"
|
|
137
|
+
|
|
138
|
+
def __get_library_versions_section(self) -> str:
|
|
139
|
+
"""
|
|
140
|
+
### Retrieves the version of the libraries used in the project.
|
|
141
|
+
|
|
142
|
+
#### Returns:
|
|
143
|
+
- (str): Libraries with their version.
|
|
144
|
+
"""
|
|
145
|
+
version_lines = []
|
|
146
|
+
for library, version in cmake_handler.get_library_versions_from_cmake_file(
|
|
147
|
+
paths.LIBRARY_VERSIONS_FILE
|
|
148
|
+
).items():
|
|
149
|
+
library_left_text = self.__add_padding_spaces(f"{library}: ")
|
|
150
|
+
version_lines.append(f"{library_left_text}{version}")
|
|
151
|
+
return '\n'.join(version_lines)
|
|
152
|
+
|
|
153
|
+
def _are_all_sources_present() -> bool:
|
|
154
|
+
"""
|
|
155
|
+
### Check if all required source packages are present.
|
|
156
|
+
|
|
157
|
+
#### Returns:
|
|
158
|
+
- (bool): True if all source packages are present, False otherwise.
|
|
159
|
+
"""
|
|
160
|
+
for source_package in paths.XMIPP_SOURCE_PATHS:
|
|
161
|
+
if not os.path.exists(source_package):
|
|
162
|
+
return False
|
|
163
|
+
return True
|
|
164
|
+
|
|
165
|
+
def _get_configuration_warning_message() -> str:
|
|
166
|
+
"""
|
|
167
|
+
### Returns a message indicating configuration is not complete.
|
|
168
|
+
|
|
169
|
+
#### Returns:
|
|
170
|
+
- (str):
|
|
171
|
+
"""
|
|
172
|
+
return '\n'.join([
|
|
173
|
+
logger.yellow("This project has not yet been configured, so some detectable dependencies have not been properly detected."),
|
|
174
|
+
logger.yellow("Run mode 'getSources' and then 'configBuild' to be able to show all detectable ones.")
|
|
175
|
+
])
|
|
@@ -5,33 +5,33 @@ from typing import List, Tuple, Callable, Any
|
|
|
5
5
|
|
|
6
6
|
def run_parallel_jobs(
|
|
7
7
|
funcs: List[Callable],
|
|
8
|
-
func_args: List[Tuple[Any]],
|
|
8
|
+
func_args: List[Tuple[Any, ...]],
|
|
9
9
|
n_jobs: int=multiprocessing.cpu_count()
|
|
10
10
|
) -> List:
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
"""
|
|
12
|
+
### Runs the given command list in parallel.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
#### Params:
|
|
15
|
+
- funcs (list(callable)): Functions to run.
|
|
16
|
+
- func_args (list(tuple(any, ...))): Arguments for each function.
|
|
17
|
+
- n_jobs (int): Optional. Number of parallel jobs.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
#### Returns:
|
|
20
|
+
- (list): List containing the return of each function.
|
|
21
|
+
"""
|
|
22
|
+
with multiprocessing.Pool(n_jobs) as p:
|
|
23
|
+
results = p.starmap(__run_lambda, zip(funcs, func_args))
|
|
24
|
+
return results
|
|
25
25
|
|
|
26
26
|
def __run_lambda(func: Callable, args: Tuple[Any]) -> Any:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
"""
|
|
28
|
+
### Runs the given function with its args.
|
|
29
|
+
|
|
30
|
+
#### Params:
|
|
31
|
+
- func (callable): Function to run.
|
|
32
|
+
- args (tuple(any)): Arguments for the function.
|
|
33
|
+
|
|
34
|
+
#### Returns:
|
|
35
|
+
- (any): Return of the called function.
|
|
36
|
+
"""
|
|
37
|
+
return func(*args)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
"""### URLs
|
|
1
|
+
"""### URLs."""
|
|
2
2
|
|
|
3
3
|
DOCUMENTATION_URL = 'https://i2pc.github.io/docs/'
|
|
4
|
-
CMAKE_INSTALL_DOCS_URL = 'https://i2pc.github.io/docs/Installation/
|
|
4
|
+
CMAKE_INSTALL_DOCS_URL = 'https://i2pc.github.io/docs/Installation/Requirements/index.html#cmake'
|
|
5
5
|
API_URL = 'https://xmipp.i2pc.es/api/attempts/'
|
|
6
|
-
MODELS_URL= "http://
|
|
6
|
+
MODELS_URL= "http://scipion.cnb.csic.es/downloads/scipion/software/em"
|
|
7
7
|
SCIPION_TESTS_URL = "http://scipion.cnb.csic.es/downloads/scipion/data/tests"
|
|
8
8
|
I2PC_REPOSITORY_URL = "https://github.com/i2pc/"
|
|
9
|
+
DLTK_DOCS_URL = "https://i2pc.github.io/docs/Installation/Optionals/index.html#deeplearningtoolkit"
|