xmipp3-installer 1.0.1__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 -0
- 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.1.dist-info → xmipp3_installer-1.1.0.dist-info}/WHEEL +1 -1
- xmipp3_installer-1.0.1.dist-info/METADATA +0 -729
- xmipp3_installer-1.0.1.dist-info/RECORD +0 -70
- {xmipp3_installer-1.0.1.dist-info → xmipp3_installer-1.1.0.dist-info}/entry_points.txt +0 -0
- /xmipp3_installer-1.0.1.dist-info/LICENSE → /xmipp3_installer-1.1.0.dist-info/licenses/LICENSE.txt +0 -0
- {xmipp3_installer-1.0.1.dist-info → xmipp3_installer-1.1.0.dist-info}/top_level.txt +0 -0
|
@@ -10,105 +10,104 @@ from xmipp3_installer.application.logger.logger import logger
|
|
|
10
10
|
from xmipp3_installer.application.logger import errors
|
|
11
11
|
|
|
12
12
|
def run_shell_command(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
cmd: str,
|
|
14
|
+
*,
|
|
15
|
+
cwd: str='./',
|
|
16
|
+
show_command: bool=False,
|
|
17
|
+
show_output: bool=False,
|
|
18
|
+
show_error: bool=False
|
|
19
19
|
) -> Tuple[int, str]:
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
"""
|
|
21
|
+
### This function runs the given command.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- substitute (bool): Optional. If True, output will replace previous line.
|
|
23
|
+
#### Params:
|
|
24
|
+
- cmd (str): Command to run.
|
|
25
|
+
- cwd (str): Optional. Path to run the command from. Default is current directory.
|
|
26
|
+
- show_output (bool): Optional. If True, output is printed.
|
|
27
|
+
- show_error (bool): Optional. If True, errors are printed.
|
|
28
|
+
- show_command (bool): Optional. If True, command is printed in blue.
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
#### Returns:
|
|
31
|
+
- (int): Return code.
|
|
32
|
+
- (str): Output of the command, regardless of if it is an error or regular output.
|
|
33
|
+
"""
|
|
34
|
+
if show_command:
|
|
35
|
+
logger(logger.blue(cmd))
|
|
36
|
+
ret_code, output_str = __run_command(cmd, cwd=cwd)
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
if not ret_code and show_output:
|
|
39
|
+
logger(output_str)
|
|
40
|
+
|
|
41
|
+
if ret_code and show_error:
|
|
42
|
+
logger(logger.red(output_str))
|
|
43
|
+
|
|
44
|
+
return ret_code, output_str
|
|
46
45
|
|
|
47
46
|
def run_shell_command_in_streaming(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
cmd: str,
|
|
48
|
+
cwd: str='./',
|
|
49
|
+
show_output: bool=False,
|
|
50
|
+
show_error: bool=False,
|
|
51
|
+
substitute: bool=False
|
|
53
52
|
) -> int:
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
"""
|
|
54
|
+
### Runs the given command and shows its output as it is being generated.
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
#### Params:
|
|
57
|
+
- cmd (str): Command to run.
|
|
58
|
+
- cwd (str): Optional. Path to run the command from. Default is current directory.
|
|
59
|
+
- show_output (bool): Optional. If True, output is printed.
|
|
60
|
+
- show_error (bool): Optional. If True, errors are printed.
|
|
61
|
+
- substitute (bool): Optional. If True, output will replace previous line.
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
63
|
+
#### Returns:
|
|
64
|
+
- (int): Return code.
|
|
65
|
+
"""
|
|
66
|
+
logger(cmd, substitute=substitute)
|
|
67
|
+
process = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
|
68
|
+
|
|
69
|
+
thread_out = threading.Thread(
|
|
70
|
+
target=logger.log_in_streaming,
|
|
71
|
+
args=(process.stdout,),
|
|
72
|
+
kwargs={"show_in_terminal": show_output, "substitute": substitute, "err": False}
|
|
73
|
+
)
|
|
74
|
+
thread_err = threading.Thread(
|
|
75
|
+
target=logger.log_in_streaming,
|
|
76
|
+
args=(process.stderr,),
|
|
77
|
+
kwargs={"show_in_terminal": show_error, "substitute": substitute, "err": True}
|
|
78
|
+
)
|
|
79
|
+
thread_out.start()
|
|
80
|
+
thread_err.start()
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
try:
|
|
83
|
+
process.wait()
|
|
84
|
+
thread_out.join()
|
|
85
|
+
thread_err.join()
|
|
86
|
+
except KeyboardInterrupt:
|
|
87
|
+
process.returncode = errors.INTERRUPTED_ERROR
|
|
88
|
+
|
|
89
|
+
return process.returncode
|
|
91
90
|
|
|
92
91
|
def __run_command(cmd: str, cwd: str='./') -> Tuple[int, str]:
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
"""
|
|
93
|
+
### Runs the given shell command.
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
#### Params:
|
|
96
|
+
- cmd (str): Command to run.
|
|
97
|
+
- cwd (str): Optional. Path to run the command from.
|
|
99
98
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
99
|
+
#### Returns:
|
|
100
|
+
- (int): Return code of the operation.
|
|
101
|
+
- (str): Return message of the operation.
|
|
102
|
+
"""
|
|
103
|
+
process = subprocess.Popen(cmd, cwd=cwd, env=os.environ, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
|
104
|
+
try:
|
|
105
|
+
process.wait()
|
|
106
|
+
except KeyboardInterrupt:
|
|
107
|
+
return errors.INTERRUPTED_ERROR, ""
|
|
108
|
+
|
|
109
|
+
ret_code = process.returncode
|
|
110
|
+
output, err = process.communicate()
|
|
111
|
+
output_str = output.decode() if not ret_code and output else err.decode()
|
|
112
|
+
output_str = output_str[:-1] if output_str.endswith('\n') else output_str
|
|
113
|
+
return ret_code, output_str
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"""
|
|
2
|
+
### Versions Manager Module.
|
|
3
|
+
|
|
4
|
+
This module contains the class to manage version information.
|
|
5
|
+
"""
|
|
6
|
+
|
|
1
7
|
import json
|
|
2
8
|
from datetime import datetime
|
|
3
9
|
from typing import Dict, List
|
|
@@ -6,6 +12,12 @@ from xmipp3_installer.installer import constants
|
|
|
6
12
|
from xmipp3_installer.shared import singleton
|
|
7
13
|
|
|
8
14
|
class VersionsManager(singleton.Singleton):
|
|
15
|
+
"""
|
|
16
|
+
### Versions Manager.
|
|
17
|
+
|
|
18
|
+
Manages version information by reading and validating version data from a JSON file.
|
|
19
|
+
"""
|
|
20
|
+
|
|
9
21
|
def __init__(self, version_file_path: str):
|
|
10
22
|
"""
|
|
11
23
|
### Constructor.
|
|
@@ -27,14 +39,14 @@ class VersionsManager(singleton.Singleton):
|
|
|
27
39
|
self.sources_versions = version_info["sources_target_tag"]
|
|
28
40
|
self.__validate_fields()
|
|
29
41
|
|
|
30
|
-
def __get_version_info(self) -> Dict[str, str]:
|
|
42
|
+
def __get_version_info(self) -> Dict[str, Dict[str, str]]:
|
|
31
43
|
"""
|
|
32
44
|
### Retrieves the version info from the version information JSON file.
|
|
33
45
|
|
|
34
46
|
#### Returns:
|
|
35
|
-
- (dict(str, str)): Dictionary containing the parsed values.
|
|
47
|
+
- (dict(str, dict(str, str))): Dictionary containing the parsed values.
|
|
36
48
|
"""
|
|
37
|
-
with open(self.version_file_path) as json_data:
|
|
49
|
+
with open(self.version_file_path, encoding="utf-8") as json_data:
|
|
38
50
|
version_info = json.load(json_data)
|
|
39
51
|
return version_info
|
|
40
52
|
|
|
@@ -62,12 +74,13 @@ class VersionsManager(singleton.Singleton):
|
|
|
62
74
|
- ValueError: If any version number doesn't follow the required format.
|
|
63
75
|
"""
|
|
64
76
|
parts = self.xmipp_version_number.split('.')
|
|
65
|
-
if not
|
|
77
|
+
if not VersionsManager.__is_valid_semver(parts):
|
|
66
78
|
raise ValueError(
|
|
67
79
|
f"Version number '{self.xmipp_version_number}' is invalid. Must be three numbers separated by dots (x.y.z)."
|
|
68
80
|
)
|
|
69
81
|
|
|
70
|
-
|
|
82
|
+
@staticmethod
|
|
83
|
+
def __is_valid_semver(version_parts: List[str]) -> bool:
|
|
71
84
|
"""
|
|
72
85
|
### Checks if version parts constitute a valid semantic version.
|
|
73
86
|
|
|
@@ -77,7 +90,8 @@ class VersionsManager(singleton.Singleton):
|
|
|
77
90
|
#### Returns:
|
|
78
91
|
- (bool): True if version follows semver format, False otherwise.
|
|
79
92
|
"""
|
|
80
|
-
|
|
93
|
+
SEMVER_N_NUMBERS = 3 # 3 numbers separated by dots: X.Y.Z
|
|
94
|
+
return len(version_parts) == SEMVER_N_NUMBERS and all(part.isdigit() for part in version_parts)
|
|
81
95
|
|
|
82
96
|
def __validate_release_date(self):
|
|
83
97
|
"""
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"""
|
|
2
|
+
### Installer Service Module.
|
|
3
|
+
|
|
4
|
+
This module contains the class to manage the installation process.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Dict, cast
|
|
2
8
|
|
|
3
9
|
from xmipp3_installer.api_client import api_client
|
|
4
10
|
from xmipp3_installer.api_client.assembler import installation_info_assembler
|
|
@@ -15,13 +21,19 @@ from xmipp3_installer.repository import config
|
|
|
15
21
|
from xmipp3_installer.repository.config_vars import variables
|
|
16
22
|
|
|
17
23
|
class InstallationManager:
|
|
24
|
+
"""
|
|
25
|
+
### Installation Manager.
|
|
26
|
+
|
|
27
|
+
Manages the installation process by executing the appropriate mode based on the given arguments.
|
|
28
|
+
"""
|
|
29
|
+
|
|
18
30
|
def __init__(self, args: Dict):
|
|
19
31
|
"""
|
|
20
|
-
|
|
32
|
+
### Constructor.
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
#### Params:
|
|
35
|
+
- args (dict): Dictionary containing all parsed command-line arguments.
|
|
36
|
+
"""
|
|
25
37
|
self.mode = args.pop(modes.MODE, modes.MODE_ALL)
|
|
26
38
|
config_handler = config.ConfigurationFileHandler(path=paths.CONFIG_FILE, show_errors=False)
|
|
27
39
|
self.context = {
|
|
@@ -50,7 +62,7 @@ class InstallationManager:
|
|
|
50
62
|
self.mode_executor.sends_installation_info and
|
|
51
63
|
self.context[variables.SEND_INSTALLATION_STATISTICS]
|
|
52
64
|
):
|
|
53
|
-
logger("Sending anonymous installation info...")
|
|
65
|
+
logger("Sending anonymous installation info...", show_in_terminal=False)
|
|
54
66
|
api_client.send_installation_attempt(
|
|
55
67
|
installation_info_assembler.get_installation_info(
|
|
56
68
|
self.context[constants.VERSIONS_CONTEXT_KEY],
|
|
@@ -59,8 +71,10 @@ class InstallationManager:
|
|
|
59
71
|
)
|
|
60
72
|
if not ret_code and self.mode_executor.prints_banner_on_exit:
|
|
61
73
|
logger(predefined_messages.get_success_message(
|
|
62
|
-
|
|
74
|
+
cast(
|
|
75
|
+
versions_manager.VersionsManager,
|
|
76
|
+
self.context[constants.VERSIONS_CONTEXT_KEY]
|
|
77
|
+
).xmipp_version_number
|
|
63
78
|
))
|
|
64
79
|
logger.close()
|
|
65
80
|
return ret_code
|
|
66
|
-
|
|
@@ -1,63 +1,73 @@
|
|
|
1
|
+
"""
|
|
2
|
+
### Mode All Executor Module.
|
|
3
|
+
|
|
4
|
+
This module contains the class to run the whole installation process.
|
|
5
|
+
"""
|
|
6
|
+
|
|
1
7
|
from typing import Tuple, Dict
|
|
2
8
|
|
|
3
9
|
from xmipp3_installer.application.cli.arguments import params
|
|
4
10
|
from xmipp3_installer.application.logger.logger import logger
|
|
5
11
|
from xmipp3_installer.installer.modes import (
|
|
6
|
-
|
|
12
|
+
mode_executor, mode_config_executor, mode_get_sources_executor
|
|
7
13
|
)
|
|
8
14
|
from xmipp3_installer.installer.modes.mode_cmake import (
|
|
9
|
-
|
|
15
|
+
mode_config_build_executor, mode_compile_and_install_executor
|
|
10
16
|
)
|
|
11
17
|
|
|
12
18
|
class ModeAllExecutor(mode_executor.ModeExecutor):
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
"""
|
|
20
|
+
### Mode All Executor.
|
|
21
|
+
|
|
22
|
+
Runs the whole installation process with the appropriate parameters.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __init__(self, context: Dict):
|
|
26
|
+
"""
|
|
27
|
+
### Constructor.
|
|
28
|
+
|
|
29
|
+
#### Params:
|
|
30
|
+
- context (dict): Dictionary containing the installation context variables.
|
|
31
|
+
"""
|
|
32
|
+
config_executor = mode_config_executor.ModeConfigExecutor(
|
|
33
|
+
{**context, params.PARAM_OVERWRITE: False}
|
|
34
|
+
)
|
|
35
|
+
get_sources_executor = mode_get_sources_executor.ModeGetSourcesExecutor(
|
|
36
|
+
context
|
|
28
37
|
)
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
config_build_executor = mode_config_build_executor.ModeConfigBuildExecutor(
|
|
39
|
+
context
|
|
31
40
|
)
|
|
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
|
-
|
|
41
|
+
compile_and_install_executor = mode_compile_and_install_executor.ModeCompileAndInstallExecutor(
|
|
42
|
+
context
|
|
43
|
+
)
|
|
44
|
+
self.executors = [
|
|
45
|
+
config_executor,
|
|
46
|
+
get_sources_executor,
|
|
47
|
+
config_build_executor,
|
|
48
|
+
compile_and_install_executor
|
|
49
|
+
]
|
|
50
|
+
super().__init__(context)
|
|
51
|
+
|
|
52
|
+
def _set_executor_config(self):
|
|
53
|
+
"""### Sets the specific executor params for this mode."""
|
|
54
|
+
super()._set_executor_config()
|
|
55
|
+
self.logs_to_file = True
|
|
56
|
+
self.prints_with_substitution = True
|
|
57
|
+
self.prints_banner_on_exit = True
|
|
58
|
+
self.sends_installation_info = True
|
|
59
|
+
|
|
60
|
+
def run(self) -> Tuple[int, str]:
|
|
61
|
+
"""
|
|
62
|
+
### Runs the whole installation process with the appropiate params.
|
|
63
|
+
|
|
64
|
+
#### Returns:
|
|
65
|
+
- (tuple(int, str)): Tuple containing the error status and an error message if there was an error.
|
|
66
|
+
"""
|
|
67
|
+
for executor_index in range(len(self.executors)):
|
|
68
|
+
if executor_index != 0:
|
|
69
|
+
logger("")
|
|
70
|
+
ret_code, output = self.executors[executor_index].run()
|
|
71
|
+
if ret_code:
|
|
72
|
+
return ret_code, output
|
|
73
|
+
return 0, ""
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"""
|
|
2
|
+
### Mode Clean All Executor Module.
|
|
3
|
+
|
|
4
|
+
This module contains the class to clean all content from source and build directories.
|
|
5
|
+
"""
|
|
6
|
+
|
|
1
7
|
from typing import List
|
|
2
8
|
|
|
3
9
|
from xmipp3_installer.application.logger.logger import logger
|
|
@@ -6,39 +12,41 @@ from xmipp3_installer.installer.constants import paths
|
|
|
6
12
|
from xmipp3_installer.installer.modes.mode_clean import mode_clean_executor
|
|
7
13
|
|
|
8
14
|
class ModeCleanAllExecutor(mode_clean_executor.ModeCleanExecutor):
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
15
|
+
"""
|
|
16
|
+
### Mode Clean All Executor.
|
|
17
|
+
|
|
18
|
+
Cleans all content from source and build directories.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def confirmation_keyword(self) -> str:
|
|
23
|
+
"""### Property containineg the keyword to confirm the cleaning operation."""
|
|
24
|
+
return "YeS"
|
|
25
|
+
|
|
26
|
+
@staticmethod
|
|
27
|
+
def _get_paths_to_delete() -> List[str]:
|
|
28
|
+
"""
|
|
29
|
+
### Returns a list of all the paths to be deleted.
|
|
30
|
+
|
|
31
|
+
#### Returns:
|
|
32
|
+
- (list(str)): List containing all the paths to delete.
|
|
33
|
+
"""
|
|
34
|
+
return [
|
|
35
|
+
*[paths.get_source_path(source) for source in constants.XMIPP_SOURCES],
|
|
36
|
+
paths.INSTALL_PATH,
|
|
37
|
+
paths.BUILD_PATH,
|
|
38
|
+
paths.CONFIG_FILE
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
def _get_confirmation_message(self) -> str:
|
|
42
|
+
"""
|
|
43
|
+
### Returns message to be printed when asking for user confirmation.
|
|
44
|
+
|
|
45
|
+
#### Returns:
|
|
46
|
+
- (str): Confirmation message.
|
|
47
|
+
"""
|
|
48
|
+
return '\n'.join([
|
|
49
|
+
logger.yellow("WARNING: This will DELETE ALL content from src and build, and also the xmipp.conf file."),
|
|
50
|
+
logger.yellow("\tNotice that if you have unpushed changes, they will be deleted."),
|
|
51
|
+
logger.yellow(f"\nIf you are sure you want to do this, type '{self.confirmation_keyword}' (case sensitive):")
|
|
52
|
+
])
|