dev-tools-loader 0.2.0__tar.gz → 0.3.0__tar.gz
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.
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/PKG-INFO +2 -1
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/README.md +1 -0
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader/__init__.py +1 -1
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader/cli.py +16 -11
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader/dev_tools_loader.py +44 -0
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader.egg-info/PKG-INFO +2 -1
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/pyproject.toml +1 -1
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/tests/test_dev_tools_loader.py +15 -5
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/LICENSE +0 -0
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader/__main__.py +0 -0
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader.egg-info/SOURCES.txt +0 -0
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader.egg-info/dependency_links.txt +0 -0
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader.egg-info/entry_points.txt +0 -0
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader.egg-info/top_level.txt +0 -0
- {dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dev_tools_loader
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Development tools loader
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://gitlab.com/karma_electronics/desktop/dev_tools_loader
|
|
@@ -51,6 +51,7 @@ dev_tools_loader -j path/to/config.json
|
|
|
51
51
|
- **`-j`, `--json-path` *`<json_config_path>`*** **(required)** Specifies the path to the JSON configuration file that defines download targets.
|
|
52
52
|
- **`-o`, `--output-path` *`<output_dir>`*** Sets the output directory where downloaded files will be saved.
|
|
53
53
|
- **`-c`, `--clean`** If specified, deletes files in the target output directory before starting the download process.
|
|
54
|
+
- **`-t`, `--template`** Create JSON config template (json-path required).
|
|
54
55
|
- **`-h`, `--help`** Displays the help message with a summary of all available options and exits.
|
|
55
56
|
- **`--version`** Prints the current version of the `dev-tools-loader` package and exits.
|
|
56
57
|
|
|
@@ -39,6 +39,7 @@ dev_tools_loader -j path/to/config.json
|
|
|
39
39
|
- **`-j`, `--json-path` *`<json_config_path>`*** **(required)** Specifies the path to the JSON configuration file that defines download targets.
|
|
40
40
|
- **`-o`, `--output-path` *`<output_dir>`*** Sets the output directory where downloaded files will be saved.
|
|
41
41
|
- **`-c`, `--clean`** If specified, deletes files in the target output directory before starting the download process.
|
|
42
|
+
- **`-t`, `--template`** Create JSON config template (json-path required).
|
|
42
43
|
- **`-h`, `--help`** Displays the help message with a summary of all available options and exits.
|
|
43
44
|
- **`--version`** Prints the current version of the `dev-tools-loader` package and exits.
|
|
44
45
|
|
|
@@ -11,21 +11,26 @@ def main():
|
|
|
11
11
|
parser.add_argument('-j', '--json-path', help='Path to JSON config file', action='store', required=True)
|
|
12
12
|
parser.add_argument('-o', '--output-path', help='Path to output dir (default ./output)', action='store', default=Path(os.getcwd()) / Path('output'))
|
|
13
13
|
parser.add_argument('-c', '--clean', help='Clean output before load (default False)', action='store_true')
|
|
14
|
+
parser.add_argument('-t', '--template', help='Create config template (default False)', action='store_true')
|
|
14
15
|
parser.add_argument('--version', help='Show version', action='version', version=f'%(prog)s {__version__}')
|
|
15
16
|
args = parser.parse_args()
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
dtl.run()
|
|
18
|
+
if args.template:
|
|
19
|
+
DevToolsLoader.create_template(args.json_path)
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
else:
|
|
22
|
+
try:
|
|
23
|
+
dtl = DevToolsLoader(args.json_path, args.output_path, args.clean)
|
|
24
|
+
dtl.run()
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
except KeyboardInterrupt:
|
|
27
|
+
DebugLog.log(f'\n>>> Exit by user', color='yellow')
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
except ValueError as e:
|
|
30
|
+
DebugLog.log(f'\n>>> Value error: {e}', color='red')
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
except RuntimeError as e:
|
|
33
|
+
DebugLog.log(f'\n>>> Runtime error: {e}', color='red')
|
|
34
|
+
|
|
35
|
+
finally:
|
|
36
|
+
pass
|
|
@@ -135,6 +135,50 @@ class DevToolsLoader:
|
|
|
135
135
|
self.__clean = clean
|
|
136
136
|
|
|
137
137
|
|
|
138
|
+
@staticmethod
|
|
139
|
+
def create_template(json_path: Path) -> None:
|
|
140
|
+
config_template = {
|
|
141
|
+
'version': '0.1.0',
|
|
142
|
+
'targets': [
|
|
143
|
+
{
|
|
144
|
+
'type': 'python',
|
|
145
|
+
'platform': 'win_amd64',
|
|
146
|
+
'version': '3.12.0',
|
|
147
|
+
'installer': "load",
|
|
148
|
+
'packages': [
|
|
149
|
+
{
|
|
150
|
+
'name': 'compiledb',
|
|
151
|
+
'version': '0.10.6'
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
'type': 'vscode',
|
|
157
|
+
'platform': 'win32-x64',
|
|
158
|
+
'version': '1.96.0',
|
|
159
|
+
'installer': "load",
|
|
160
|
+
'extensions': [
|
|
161
|
+
{
|
|
162
|
+
'uid': 'ms-vscode.cpptools',
|
|
163
|
+
'version': 'latest'
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if json_path:
|
|
171
|
+
json_path = Path(json_path)
|
|
172
|
+
if not json_path.parent.exists():
|
|
173
|
+
Path.mkdir(json_path.parent, parents=True)
|
|
174
|
+
with open(json_path, 'w', encoding='utf-8') as f:
|
|
175
|
+
json.dump(config_template, f, indent=4)
|
|
176
|
+
f.write('\n')
|
|
177
|
+
DebugLog.log(f'>>> Create config template \'{json_path}\'', color='bright_cyan')
|
|
178
|
+
else:
|
|
179
|
+
raise ValueError(f'json path required parameter')
|
|
180
|
+
|
|
181
|
+
|
|
138
182
|
@staticmethod
|
|
139
183
|
def __ver_2_tuple(ver_mmpb: str) -> Tuple[int]:
|
|
140
184
|
ver_mmp = ver_mmpb.split('-')[0]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dev_tools_loader
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Development tools loader
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://gitlab.com/karma_electronics/desktop/dev_tools_loader
|
|
@@ -51,6 +51,7 @@ dev_tools_loader -j path/to/config.json
|
|
|
51
51
|
- **`-j`, `--json-path` *`<json_config_path>`*** **(required)** Specifies the path to the JSON configuration file that defines download targets.
|
|
52
52
|
- **`-o`, `--output-path` *`<output_dir>`*** Sets the output directory where downloaded files will be saved.
|
|
53
53
|
- **`-c`, `--clean`** If specified, deletes files in the target output directory before starting the download process.
|
|
54
|
+
- **`-t`, `--template`** Create JSON config template (json-path required).
|
|
54
55
|
- **`-h`, `--help`** Displays the help message with a summary of all available options and exits.
|
|
55
56
|
- **`--version`** Prints the current version of the `dev-tools-loader` package and exits.
|
|
56
57
|
|
|
@@ -4,7 +4,7 @@ from pathlib import Path
|
|
|
4
4
|
from unittest.mock import patch
|
|
5
5
|
|
|
6
6
|
from dev_tools_loader.dev_tools_loader import DevToolsLoader
|
|
7
|
-
from dev_tools_loader.cli import main
|
|
7
|
+
from dev_tools_loader.cli import main as cli_main
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@pytest.fixture
|
|
@@ -76,7 +76,7 @@ def test_cli_help():
|
|
|
76
76
|
print()
|
|
77
77
|
with patch('sys.argv', ['dev_tools_loader', '-h']):
|
|
78
78
|
with pytest.raises(SystemExit):
|
|
79
|
-
|
|
79
|
+
cli_main()
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
@pytest.mark.fast
|
|
@@ -84,7 +84,7 @@ def test_cli_version():
|
|
|
84
84
|
print()
|
|
85
85
|
with patch('sys.argv', ['dev_tools_loader', '--version']):
|
|
86
86
|
with pytest.raises(SystemExit):
|
|
87
|
-
|
|
87
|
+
cli_main()
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
@pytest.mark.fast
|
|
@@ -92,7 +92,17 @@ def test_cli_invalid_config():
|
|
|
92
92
|
print()
|
|
93
93
|
with patch('sys.argv', ['dev_tools_loader']):
|
|
94
94
|
with pytest.raises(SystemExit):
|
|
95
|
-
|
|
95
|
+
cli_main()
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@pytest.mark.fast
|
|
99
|
+
def test_cli_config_template(tmp_path):
|
|
100
|
+
print()
|
|
101
|
+
config_path = tmp_path / Path('dir/config.json')
|
|
102
|
+
with patch('sys.argv', ['dev_tools_loader', '-j', str(config_path), '-t']):
|
|
103
|
+
cli_main()
|
|
104
|
+
with patch('sys.argv', ['dev_tools_loader', '-j', str(config_path), '-o', str(tmp_path)]):
|
|
105
|
+
cli_main()
|
|
96
106
|
|
|
97
107
|
|
|
98
108
|
@pytest.mark.fast
|
|
@@ -100,7 +110,7 @@ def test_config_example(tmp_path):
|
|
|
100
110
|
print()
|
|
101
111
|
config_path = Path(__file__).parent / Path('data/config_example.json')
|
|
102
112
|
with patch('sys.argv', ['dev_tools_loader', '-j', str(config_path), '-o', str(tmp_path)]):
|
|
103
|
-
|
|
113
|
+
cli_main()
|
|
104
114
|
|
|
105
115
|
|
|
106
116
|
@pytest.mark.parametrize('platform', DevToolsLoader.PYTHON_PLATFORMS)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{dev_tools_loader-0.2.0 → dev_tools_loader-0.3.0}/dev_tools_loader.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|