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,6 +1,5 @@
|
|
|
1
1
|
"""### Provides a global logger."""
|
|
2
2
|
|
|
3
|
-
import math
|
|
4
3
|
import shutil
|
|
5
4
|
from io import BufferedReader
|
|
6
5
|
|
|
@@ -9,221 +8,225 @@ from xmipp3_installer.application.logger import errors
|
|
|
9
8
|
from xmipp3_installer.installer import urls
|
|
10
9
|
|
|
11
10
|
class Logger(Singleton):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
__FORMATTING_CHARACTERS = [__UP, __REMOVE_LINE, __BOLD, __BLUE, __RED, __GREEN, __YELLOW, __END_FORMAT]
|
|
11
|
+
"""### Logger class for keeping track of installation messages."""
|
|
12
|
+
|
|
13
|
+
__UP = "\x1B[1A\r"
|
|
14
|
+
__REMOVE_LINE = '\033[K'
|
|
15
|
+
__BOLD = "\033[1m"
|
|
16
|
+
__BLUE = "\033[34m"
|
|
17
|
+
__RED = "\033[91m"
|
|
18
|
+
__GREEN = "\033[92m"
|
|
19
|
+
__YELLOW = "\033[93m"
|
|
20
|
+
__END_FORMAT = "\033[0m"
|
|
21
|
+
__FORMATTING_CHARACTERS = [__UP, __REMOVE_LINE, __BOLD, __BLUE, __RED, __GREEN, __YELLOW, __END_FORMAT]
|
|
24
22
|
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
23
|
+
def __init__(self):
|
|
24
|
+
"""
|
|
25
|
+
### Constructor.
|
|
26
|
+
|
|
27
|
+
#### Params:
|
|
28
|
+
- ouputToConsoloe (bool): Print messages to console.
|
|
29
|
+
"""
|
|
30
|
+
self.__log_file = None
|
|
31
|
+
self.__last_printed_elem = None
|
|
32
|
+
self.__allow_substitution = True
|
|
33
|
+
|
|
34
|
+
def green(self, text: str) -> str:
|
|
35
|
+
"""
|
|
36
|
+
### This function returns the given text formatted in green color.
|
|
37
|
+
|
|
38
|
+
#### Params:
|
|
39
|
+
- text (str): Text to format.
|
|
40
|
+
|
|
41
|
+
#### Returns:
|
|
42
|
+
- (str): Text formatted in green color.
|
|
43
|
+
"""
|
|
44
|
+
return self.__format_text(text, self.__GREEN)
|
|
45
|
+
|
|
46
|
+
def yellow(self, text: str) -> str:
|
|
47
|
+
"""
|
|
48
|
+
### This function returns the given text formatted in yellow color.
|
|
49
|
+
|
|
50
|
+
#### Params:
|
|
51
|
+
- text (str): Text to format.
|
|
52
|
+
|
|
53
|
+
#### Returns:
|
|
54
|
+
- (str): Text formatted in yellow color.
|
|
55
|
+
"""
|
|
56
|
+
return self.__format_text(text, self.__YELLOW)
|
|
57
|
+
|
|
58
|
+
def red(self, text: str) -> str:
|
|
59
|
+
"""
|
|
60
|
+
### This function returns the given text formatted in red color.
|
|
61
|
+
|
|
62
|
+
#### Params:
|
|
63
|
+
- text (str): Text to format.
|
|
64
|
+
|
|
65
|
+
#### Returns:
|
|
66
|
+
- (str): Text formatted in red color.
|
|
67
|
+
"""
|
|
68
|
+
return self.__format_text(text, self.__RED)
|
|
69
|
+
|
|
70
|
+
def blue(self, text: str) -> str:
|
|
71
|
+
"""
|
|
72
|
+
### This function returns the given text formatted in blue color.
|
|
73
|
+
|
|
74
|
+
#### Params:
|
|
75
|
+
- text (str): Text to format.
|
|
76
|
+
|
|
77
|
+
#### Returns:
|
|
78
|
+
- (str): Text formatted in blue color.
|
|
79
|
+
"""
|
|
80
|
+
return self.__format_text(text, self.__BLUE)
|
|
81
|
+
|
|
82
|
+
def bold(self, text: str) -> str:
|
|
83
|
+
"""
|
|
84
|
+
### This function returns the given text formatted in bold.
|
|
85
|
+
|
|
86
|
+
#### Params:
|
|
87
|
+
- text (str): Text to format.
|
|
88
|
+
|
|
89
|
+
#### Returns:
|
|
90
|
+
- (str): Text formatted in bold.
|
|
91
|
+
"""
|
|
92
|
+
return self.__format_text(text, self.__BOLD)
|
|
93
|
+
|
|
94
|
+
def start_log_file(self, log_path: str):
|
|
95
|
+
"""
|
|
96
|
+
### Initiates the log file.
|
|
97
|
+
|
|
98
|
+
#### Params:
|
|
99
|
+
- log_path (str): Path to the log file.
|
|
100
|
+
"""
|
|
101
|
+
if self.__log_file is None:
|
|
102
|
+
self.__log_file = open(log_path, 'w', encoding="utf-8")
|
|
103
|
+
|
|
104
|
+
def close(self):
|
|
105
|
+
"""### Closes the log file."""
|
|
106
|
+
if self.__log_file:
|
|
107
|
+
self.__log_file.close()
|
|
108
|
+
self.__log_file = None
|
|
109
|
+
|
|
110
|
+
def set_allow_substitution(self, allow_substitution: bool):
|
|
111
|
+
"""
|
|
112
|
+
### Modifies console output behaviour, allowing or disallowing substitutions.
|
|
113
|
+
|
|
114
|
+
#### Params:
|
|
115
|
+
- allow_substitution (bool): If False, console outputs won't be substituted.
|
|
116
|
+
"""
|
|
117
|
+
self.__allow_substitution = allow_substitution
|
|
118
|
+
|
|
119
|
+
def __call__(self, text: str, show_in_terminal: bool=True, substitute: bool=False):
|
|
120
|
+
"""
|
|
121
|
+
### Log a message.
|
|
122
|
+
|
|
123
|
+
#### Params:
|
|
124
|
+
- text (str): Message to be logged. Supports fancy formatting.
|
|
125
|
+
- show_in_terminal (bool): Optional. If True, text is also printed through terminal.
|
|
126
|
+
- substitute (bool): Optional. If True, previous line is substituted with new text. Only used when show_in_terminal = True.
|
|
127
|
+
"""
|
|
128
|
+
if self.__log_file is not None:
|
|
129
|
+
print(self.__remove_non_printable(text), file=self.__log_file, flush=True)
|
|
130
|
+
|
|
131
|
+
if show_in_terminal:
|
|
132
|
+
text = self.__substitute_lines(text) if self.__allow_substitution and substitute else text
|
|
133
|
+
print(text, flush=True)
|
|
134
|
+
|
|
135
|
+
# Store printed string for next substitution calculation
|
|
136
|
+
self.__last_printed_elem = self.__remove_non_printable(text) if self.__allow_substitution and substitute else None
|
|
137
|
+
|
|
138
|
+
def log_error(self, error_msg: str, ret_code: int=1, add_portal_link: bool=True):
|
|
139
|
+
"""
|
|
140
|
+
### Prints an error message.
|
|
141
|
+
|
|
142
|
+
#### Params:
|
|
143
|
+
- error_msg (str): Error message to show.
|
|
144
|
+
- ret_code (int): Optional. Return code to end the exection with.
|
|
145
|
+
- add_portal_link (bool): If True, a message linking the documentation portal is shown.
|
|
146
|
+
"""
|
|
147
|
+
error = errors.ERROR_CODES.get(ret_code, errors.ERROR_CODES[errors.UNKOW_ERROR])
|
|
148
|
+
error_str = error_msg + '\n\n' if error_msg else ''
|
|
149
|
+
error_str += f'Error {ret_code}: {error[0]}'
|
|
150
|
+
error_str += f"\n{error[1]}" if error[1] else ''
|
|
151
|
+
if add_portal_link:
|
|
152
|
+
error_str += f'\nMore details on the Xmipp documentation portal: {urls.DOCUMENTATION_URL}'
|
|
153
|
+
|
|
154
|
+
self.__call__(self.red(error_str), show_in_terminal=True)
|
|
155
|
+
|
|
156
|
+
def log_in_streaming(self, stream: BufferedReader, show_in_terminal: bool=False, substitute: bool=False, err: bool=False):
|
|
157
|
+
"""
|
|
158
|
+
### Receives a process output stream and logs its lines.
|
|
159
|
+
|
|
160
|
+
#### Params:
|
|
161
|
+
- stream (BufferedReader): Function to run.
|
|
162
|
+
- show_in_terminal (bool): Optional. If True, output will also be printed through terminal.
|
|
163
|
+
- substitute (bool): Optional. If True, output will replace previous line. Only used when show is True.
|
|
164
|
+
- err (bool): Optional. If True, the stream contains an error. Otherwise, it is regular output.
|
|
165
|
+
"""
|
|
166
|
+
for line in iter(stream.readline, b''):
|
|
167
|
+
calling_line = line.decode().replace("\n", "")
|
|
168
|
+
if err:
|
|
169
|
+
calling_line = self.red(calling_line)
|
|
170
|
+
self.__call__(calling_line, show_in_terminal=show_in_terminal, substitute=substitute)
|
|
171
|
+
|
|
172
|
+
def __remove_non_printable(self, text: str) -> str:
|
|
173
|
+
"""
|
|
174
|
+
### This function returns the given text without non printable characters.
|
|
175
|
+
|
|
176
|
+
#### Params:
|
|
177
|
+
- text (str): Text to remove format.
|
|
178
|
+
|
|
179
|
+
#### Returns:
|
|
180
|
+
- (str): Text without format.
|
|
181
|
+
"""
|
|
182
|
+
for formatting_char in self.__FORMATTING_CHARACTERS:
|
|
183
|
+
text = text.replace(formatting_char, "")
|
|
184
|
+
return text
|
|
185
|
+
|
|
186
|
+
def __get_n_last_lines(self) -> int:
|
|
187
|
+
"""
|
|
188
|
+
### This function returns the number of lines of the terminal the last print occupied.
|
|
189
|
+
|
|
190
|
+
#### Returns:
|
|
191
|
+
- (int): Number of lines of the last print.
|
|
192
|
+
"""
|
|
193
|
+
if self.__last_printed_elem is None:
|
|
194
|
+
return 0
|
|
195
|
+
|
|
196
|
+
terminal_width = shutil.get_terminal_size().columns
|
|
197
|
+
# At least one line break exists, as prints end with line break
|
|
198
|
+
n_line_breaks = self.__last_printed_elem.count("\n") + 1
|
|
199
|
+
text_lines = self.__last_printed_elem.split("\n")
|
|
200
|
+
for line in text_lines:
|
|
201
|
+
n_line_breaks += int(len(line) / (terminal_width + 1)) # Equal does not count, it needs to exceed
|
|
202
|
+
return n_line_breaks
|
|
203
|
+
|
|
204
|
+
def __format_text(self, text: str, format_code: str) -> str:
|
|
205
|
+
"""
|
|
206
|
+
### Returns the given text formatted in the given format code.
|
|
207
|
+
|
|
208
|
+
#### Params:
|
|
209
|
+
- text (str): Text to format.
|
|
210
|
+
- format_code (str): Formatting character.
|
|
211
|
+
|
|
212
|
+
#### Returns:
|
|
213
|
+
- (str): Text formatted.
|
|
214
|
+
"""
|
|
215
|
+
return f"{format_code}{text}{self.__END_FORMAT}"
|
|
216
|
+
|
|
217
|
+
def __substitute_lines(self, text: str) -> str:
|
|
218
|
+
"""
|
|
219
|
+
### Removes the appropiate lines from the terminal to show a given text.
|
|
220
|
+
|
|
221
|
+
#### Params:
|
|
222
|
+
- text (str): Text to show substituting some lines.
|
|
223
|
+
|
|
224
|
+
#### Returns:
|
|
225
|
+
- (str): Text with line substitution characters as a prefix.
|
|
226
|
+
"""
|
|
227
|
+
substitution_chars = [f'{self.__UP}{self.__REMOVE_LINE}' for _ in range(self.__get_n_last_lines())]
|
|
228
|
+
return f"{''.join(substitution_chars)}{text}"
|
|
229
|
+
|
|
227
230
|
"""
|
|
228
231
|
### Global logger.
|
|
229
232
|
"""
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"""
|
|
2
|
+
### Predefined Messages Module.
|
|
3
|
+
|
|
4
|
+
This module contains functions to generate standard log messages.
|
|
5
|
+
"""
|
|
6
|
+
|
|
1
7
|
from xmipp3_installer.application.logger.logger import logger
|
|
2
8
|
from xmipp3_installer.installer.handlers import git_handler
|
|
3
9
|
|
|
@@ -22,45 +28,46 @@ def get_working_message() -> str:
|
|
|
22
28
|
return logger.yellow("Working...")
|
|
23
29
|
|
|
24
30
|
def get_section_message(text: str) -> str:
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
"""
|
|
32
|
+
### Returns the given text as a section header.
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
#### Params:
|
|
35
|
+
- text (str): Title of the section.
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
#### Returns:
|
|
38
|
+
- (str): Formatted section header.
|
|
39
|
+
"""
|
|
40
|
+
minimum_remaining_len = len("- -")
|
|
41
|
+
text_len = len(text)
|
|
42
|
+
remaining_len = __SECTION_MESSAGE_LEN - text_len
|
|
43
|
+
if remaining_len < minimum_remaining_len:
|
|
44
|
+
return text
|
|
45
|
+
|
|
46
|
+
n_dashes = remaining_len - 2
|
|
47
|
+
n_final_dashes = int(n_dashes / 2)
|
|
48
|
+
n_initial_dashes = n_dashes - n_final_dashes
|
|
49
|
+
final_dashes = ''.join(['-' for _ in range(n_final_dashes)])
|
|
50
|
+
initial_dashes = ''.join(['-' for _ in range(n_initial_dashes)])
|
|
51
|
+
return f"{initial_dashes} {text} {final_dashes}"
|
|
45
52
|
|
|
46
53
|
def get_success_message(tag_version: str) -> str:
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
"""
|
|
55
|
+
### Returns the message shown when Xmipp is compiled successfully.
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
#### Params:
|
|
58
|
+
- tag_version (str): Version number of the latest release.
|
|
59
|
+
|
|
60
|
+
#### Returms:
|
|
61
|
+
- (str): Success message.
|
|
62
|
+
"""
|
|
63
|
+
release_name = tag_version if git_handler.is_tag() else git_handler.get_current_branch()
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
box_wrapper = '* *'
|
|
66
|
+
half_len_box_wrapper = int(len(box_wrapper) / 2)
|
|
67
|
+
release_message = f'Xmipp {release_name} has been successfully installed, enjoy it!'
|
|
68
|
+
total_len = len(release_message) + len(box_wrapper)
|
|
69
|
+
release_message = f'{box_wrapper[:half_len_box_wrapper]}{logger.green(release_message)}{box_wrapper[half_len_box_wrapper:]}'
|
|
70
|
+
margin_line = f"*{' ' * (total_len - 2)}*"
|
|
71
|
+
box_border = '*' * total_len
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
return '\n'.join(["", box_border, margin_line, release_message, margin_line, box_border])
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"""
|
|
2
|
+
### Paths Module.
|
|
3
|
+
|
|
4
|
+
This module defines various paths used throughout the application.
|
|
5
|
+
"""
|
|
6
|
+
|
|
1
7
|
import os
|
|
2
8
|
|
|
3
9
|
from xmipp3_installer.installer import constants
|
|
@@ -7,7 +13,6 @@ SOURCES_PATH = "src"
|
|
|
7
13
|
BUILD_PATH = "build"
|
|
8
14
|
INSTALL_PATH = "dist"
|
|
9
15
|
BINARIES_PATH = os.path.join(INSTALL_PATH, "bin")
|
|
10
|
-
#CMAKE_CACHE_PATH = os.path.join(BUILD_PATH, 'CMakeCache.txt')
|
|
11
16
|
SCIPION_SOFTWARE_EM = os.path.join("scipionfiles", "downloads", "scipion", "software", "em")
|
|
12
17
|
|
|
13
18
|
# General file paths
|