Skip to content

Commit 16d8435

Browse files
committed
dev(hansbug): add versions non-finished ci skip
1 parent 7f53758 commit 16d8435

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ TEST_DIR := ${PROJ_DIR}/test
1111
SRC_DIR := ${PROJ_DIR}/plantumlcli
1212
DIST_DIR := ${PROJ_DIR}/dist
1313

14+
KNOWN_VERSION_FILE ?= ${SRC_DIR}/download/exist_versions.py
15+
1416
RANGE_DIR ?= .
1517
RANGE_TEST_DIR := ${TEST_DIR}/${RANGE_DIR}
1618
RANGE_SRC_DIR := ${SRC_DIR}/${RANGE_DIR}
@@ -56,3 +58,7 @@ flake:
5658

5759
package:
5860
python -m build --sdist --wheel --outdir ${DIST_DIR}
61+
62+
versions:
63+
python sync_known_versions.py -o ${KNOWN_VERSION_FILE}
64+
ruff format ${KNOWN_VERSION_FILE}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
KNOWN_VERSIONS = {
2+
"1.2017.12": {
3+
"content_length": 5860865,
4+
"sha256": "3eb511e45c4b31666b365020ed046b4b670d877e248b6fa8d76ca2c9cbefc5ab",
5+
"url": "https://sourceforge.net/projects/plantuml/files/1.2017.12/plantuml.1.2017.12.jar/download",
6+
"version": "1.2017.12",
7+
"version_tuple": (1, 2017, 12),
8+
},
9+
"1.2017.13": {
10+
"content_length": 5868556,
11+
"sha256": "068842ef3035eaaaf2642cf7fb8f5325c98de02f6ea189acda8448614258a0b2",
12+
"url": "https://sourceforge.net/projects/plantuml/files/1.2017.13/plantuml.1.2017.13.jar/download",
13+
"version": "1.2017.13",
14+
"version_tuple": (1, 2017, 13),
15+
},
16+
"1.2017.14": {
17+
"content_length": 5877971,
18+
"sha256": "08d83041814057d8d99c72ecada7e0f7e52e46265ee4af3ebc64525b63ef46ed",
19+
"url": "https://sourceforge.net/projects/plantuml/files/1.2017.14/plantuml.1.2017.14.jar/download",
20+
"version": "1.2017.14",
21+
"version_tuple": (1, 2017, 14),
22+
},
23+
"1.2022.0": {
24+
"content_length": 9914199,
25+
"sha256": "f1070c42b20e6a38015e52c10821a9db13bedca6b5d5bc6a6192fcab6e612691",
26+
"url": "https://github.com/plantuml/plantuml/releases/download/v1.2022.0/plantuml-1.2022.0.jar",
27+
"version": "1.2022.0",
28+
"version_tuple": (1, 2022, 0),
29+
},
30+
"1.2022.1": {
31+
"content_length": 9942607,
32+
"sha256": "111995d0f54f18f5a6faa7f4e0360abc2fee9400d54595ca5fe6ab0ddeda1e61",
33+
"url": "https://github.com/plantuml/plantuml/releases/download/v1.2022.1/plantuml-1.2022.1.jar",
34+
"version": "1.2022.1",
35+
"version_tuple": (1, 2022, 1),
36+
},
37+
"1.2022.2": {
38+
"content_length": 10068732,
39+
"sha256": "0a4954d73507495f0f0898639e819cb08b00e7fa0450bd6c87c90e1aae544b8b",
40+
"url": "https://github.com/plantuml/plantuml/releases/download/v1.2022.2/plantuml-1.2022.2.jar",
41+
"version": "1.2022.2",
42+
"version_tuple": (1, 2022, 2),
43+
},
44+
}

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruff

sync_known_versions.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import argparse
12
import hashlib
23
import os
34
import pathlib
@@ -202,7 +203,7 @@ def _get_version_info(version: str, url: str, session=None):
202203
if not data:
203204
break
204205
sha256_hash.update(data)
205-
sha256_result = sha256_hash
206+
sha256_result = sha256_hash.hexdigest()
206207

207208
return {
208209
'version': version,
@@ -214,17 +215,21 @@ def _get_version_info(version: str, url: str, session=None):
214215

215216

216217
if __name__ == '__main__':
218+
parser = argparse.ArgumentParser(description='Update known version information')
219+
parser.add_argument('-o', '--output_file', required=True, help='Output files of known versions')
220+
221+
args = parser.parse_args()
217222
session = get_requests_session()
218223

219-
dst_file = os.path.join('plantumlcli', 'download', 'exist_versions.py')
224+
dst_file = args.output_file
220225
os.makedirs(os.path.dirname(dst_file), exist_ok=True)
221226
if os.path.exists(dst_file):
222227
exec(pathlib.Path(dst_file).read_text())
223228
known_versions: Dict[str, dict] = vars()['KNOWN_VERSIONS']
224229
else:
225230
known_versions: Dict[str, dict] = {}
226231

227-
for version in tqdm(sourceforge_versions[::-1]):
232+
for version in tqdm(sourceforge_versions[::-1][:30]):
228233
if version in known_versions:
229234
continue
230235
url = f'https://sourceforge.net/projects/plantuml/files/{version}/plantuml.{version}.jar/download'
@@ -233,7 +238,7 @@ def _get_version_info(version: str, url: str, session=None):
233238
continue
234239
known_versions[version] = _info
235240

236-
for version in tqdm(github_versions[::-1]):
241+
for version in tqdm(github_versions[::-1][:30]):
237242
if version in known_versions:
238243
continue
239244
url = f'https://github.com/plantuml/plantuml/releases/download/v{version}/plantuml-{version}.jar'

0 commit comments

Comments
 (0)