fosslight-util 2.2.4__tar.gz → 2.2.5__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.
- {fosslight_util-2.2.4/src/fosslight_util.egg-info → fosslight_util-2.2.5}/PKG-INFO +1 -1
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/pyproject.toml +1 -1
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/download.py +37 -12
- {fosslight_util-2.2.4 → fosslight_util-2.2.5/src/fosslight_util.egg-info}/PKG-INFO +1 -1
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_decide_checkout.py +57 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_download_version_hint.py +20 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/LICENSE +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/MANIFEST.in +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/README.md +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/setup.cfg +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/__init__.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/_get_downloadable_url.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/compare_yaml.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/constant.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/correct.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/cover.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/exclude.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/get_pom_license.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/help.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/oss_item.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/output_format.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/parsing_yaml.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/read_excel.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/resources/frequentLicenselist.json +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/resources/frequent_license_nick_list.json +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/resources/licenses.json +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/set_log.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/spdx_licenses.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/time.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/timer_thread.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/write_cyclonedx.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/write_excel.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/write_opossum.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/write_scancodejson.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/write_spdx.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/write_txt.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/write_yaml.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util.egg-info/SOURCES.txt +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util.egg-info/dependency_links.txt +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util.egg-info/entry_points.txt +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util.egg-info/requires.txt +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util.egg-info/top_level.txt +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_cyclonedx.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_download.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_download_packagist.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_opossum.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_spdx_licenses.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_text.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_write_excel_hidden_sheet.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_write_output.py +0 -0
- {fosslight_util-2.2.4 → fosslight_util-2.2.5}/tests/test_write_yaml.py +0 -0
|
@@ -279,6 +279,7 @@ def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_
|
|
|
279
279
|
msg_wget = ""
|
|
280
280
|
oss_name = ""
|
|
281
281
|
oss_version = ""
|
|
282
|
+
clarified_from_git = ""
|
|
282
283
|
downloaded_link = ""
|
|
283
284
|
size_limit_blocked = False
|
|
284
285
|
log_file_name = "fosslight_download_" + \
|
|
@@ -305,7 +306,7 @@ def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_
|
|
|
305
306
|
is_rubygems = src_info.get("rubygems", False)
|
|
306
307
|
|
|
307
308
|
# General download: git clone → requests → system wget
|
|
308
|
-
success_git, msg, oss_name, oss_version,
|
|
309
|
+
success_git, msg, oss_name, oss_version, clarified_from_git = download_git_clone(
|
|
309
310
|
link, target_dir, checkout_to, tag, branch,
|
|
310
311
|
ssh_key, id, git_token, called_cli, size_limit_gb=size_limit_gb)
|
|
311
312
|
link = change_ssh_link_to_https(link)
|
|
@@ -367,7 +368,11 @@ def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_
|
|
|
367
368
|
success = False
|
|
368
369
|
msg = str(error)
|
|
369
370
|
|
|
370
|
-
clarified_version =
|
|
371
|
+
clarified_version = (
|
|
372
|
+
clarified_from_git
|
|
373
|
+
if success and clarified_from_git
|
|
374
|
+
else clarified_version_from_oss_version(oss_version)
|
|
375
|
+
)
|
|
371
376
|
output_link = downloaded_link if success else ""
|
|
372
377
|
output_result = {
|
|
373
378
|
"success": success,
|
|
@@ -446,18 +451,18 @@ _BASE_SEMVER_FOR_CHECKOUT = re.compile(
|
|
|
446
451
|
re.IGNORECASE,
|
|
447
452
|
)
|
|
448
453
|
_SEMVER_IN_REF = re.compile(
|
|
449
|
-
r'(?:^v\.? ?|[-_]v\.? ?|[-_])'
|
|
454
|
+
r'(?:^v\.? ?|[-_@]v\.? ?|[-_@])'
|
|
450
455
|
r'(\d+)\.(\d+)\.(\d+)'
|
|
451
456
|
r'(?:(?:-[0-9A-Za-z.-]+)|(?:\.[A-Za-z][0-9A-Za-z.-]*))?'
|
|
452
457
|
r'(?:\+[0-9A-Za-z.-]+)?'
|
|
453
|
-
r'(?=[-_]|$)',
|
|
458
|
+
r'(?=[-_@]|$)',
|
|
454
459
|
re.IGNORECASE,
|
|
455
460
|
)
|
|
456
461
|
_SEMVER_AT_REF_START = re.compile(
|
|
457
462
|
r'^(\d+)\.(\d+)\.(\d+)'
|
|
458
463
|
r'(?:(?:-[0-9A-Za-z.-]+)|(?:\.[A-Za-z][0-9A-Za-z.-]*))?'
|
|
459
464
|
r'(?:\+[0-9A-Za-z.-]+)?'
|
|
460
|
-
r'(?=[-_]|$)',
|
|
465
|
+
r'(?=[-_@]|$)',
|
|
461
466
|
re.IGNORECASE,
|
|
462
467
|
)
|
|
463
468
|
_SEMVER_DOT_QUALIFIER_IN_STR = re.compile(
|
|
@@ -467,8 +472,11 @@ _SEMVER_DOT_QUALIFIER_IN_STR = re.compile(
|
|
|
467
472
|
_CLARIFIED_MAJOR_ONLY_FULL = re.compile(r'^(?:v\.? ?)?(\d+)$', re.IGNORECASE)
|
|
468
473
|
# Maven / OSGi style: 1.1.7.7 (more than three numeric segments; not strict semver)
|
|
469
474
|
_PURE_DOT_NUMERIC_VERSION = re.compile(r'^\d+(\.\d+)+$')
|
|
470
|
-
#
|
|
471
|
-
|
|
475
|
+
# Three-part x.y.z anywhere (e.g. R0.3.6, pkg0.3.6) — tried before two-part fallback
|
|
476
|
+
_SEMVER_THREE_IN_STR = re.compile(r'(\d+)\.(\d+)\.(\d+)')
|
|
477
|
+
# Two-part x.y not preceded by digit. and not followed by .digit
|
|
478
|
+
# (avoids taking "3.6" from "0.3.6" or "2.3" from "1.2.3")
|
|
479
|
+
_CLARIFIED_TWO_IN_STR = re.compile(r'(?<!\d\.)(\d+)\.(\d+)(?!\.\d)')
|
|
472
480
|
_CLARIFIED_MAJOR_IN_STR = re.compile(
|
|
473
481
|
r'(?:^|[-_/])(?:v\.? ?)?(\d+)(?=[^.\d]|$)', re.IGNORECASE
|
|
474
482
|
)
|
|
@@ -519,6 +527,9 @@ def clarified_version_from_oss_version(oss_version: str) -> str:
|
|
|
519
527
|
if m:
|
|
520
528
|
return f"{m.group(1)}.{m.group(2)}.{m.group(3)}"
|
|
521
529
|
m = _SEMVER_DOT_QUALIFIER_IN_STR.search(core)
|
|
530
|
+
if m:
|
|
531
|
+
return f"{m.group(1)}.{m.group(2)}.{m.group(3)}"
|
|
532
|
+
m = _SEMVER_THREE_IN_STR.search(core)
|
|
522
533
|
if m:
|
|
523
534
|
return f"{m.group(1)}.{m.group(2)}.{m.group(3)}"
|
|
524
535
|
m = _CLARIFIED_TWO_IN_STR.search(core)
|
|
@@ -547,7 +558,11 @@ def _strip_known_archive_suffixes(filename: str) -> str:
|
|
|
547
558
|
|
|
548
559
|
|
|
549
560
|
def _version_string_from_archive_stem(stem: str) -> str:
|
|
550
|
-
"""Take trailing version segment from name-version stems (e.g. bison-3.8.2 -> 3.8.2).
|
|
561
|
+
"""Take trailing version segment from name-version stems (e.g. bison-3.8.2 -> 3.8.2).
|
|
562
|
+
|
|
563
|
+
If the basename itself is a version (e.g. v3.28.3, 1.1.7.7), return it.
|
|
564
|
+
Plain package names without a version (e.g. printf) return "".
|
|
565
|
+
"""
|
|
551
566
|
if not stem:
|
|
552
567
|
return ""
|
|
553
568
|
m = _ARCHIVE_VERSION_TAIL.search(stem)
|
|
@@ -559,7 +574,14 @@ def _version_string_from_archive_stem(stem: str) -> str:
|
|
|
559
574
|
if classifier:
|
|
560
575
|
return classifier.group(1)
|
|
561
576
|
return version
|
|
562
|
-
|
|
577
|
+
core = _strip_leading_v_prefix(_strip_debian_epoch_prefix(stem))
|
|
578
|
+
if (
|
|
579
|
+
_PURE_DOT_NUMERIC_VERSION.match(core)
|
|
580
|
+
or _BASE_SEMVER_FOR_CHECKOUT.match(core)
|
|
581
|
+
or _CLARIFIED_MAJOR_ONLY_FULL.match(core)
|
|
582
|
+
):
|
|
583
|
+
return stem
|
|
584
|
+
return ""
|
|
563
585
|
|
|
564
586
|
|
|
565
587
|
def _oss_version_hint_from_wget_link(link: str, downloaded_file: str) -> str:
|
|
@@ -586,7 +608,9 @@ def _oss_version_hint_from_wget_link(link: str, downloaded_file: str) -> str:
|
|
|
586
608
|
stem = _strip_known_archive_suffixes(base)
|
|
587
609
|
if not stem or stem.lower() == "download":
|
|
588
610
|
continue
|
|
589
|
-
|
|
611
|
+
hint = _version_string_from_archive_stem(stem)
|
|
612
|
+
if hint:
|
|
613
|
+
return hint
|
|
590
614
|
return ""
|
|
591
615
|
|
|
592
616
|
|
|
@@ -700,10 +724,11 @@ def _try_resolve_checkout_base(base: str, ref_set: set) -> Tuple[Optional[str],
|
|
|
700
724
|
return ref, clar
|
|
701
725
|
|
|
702
726
|
# Fallback: find refs that end with the input version (case-insensitive),
|
|
703
|
-
# but only when the match starts at a separator boundary (-, _, /,
|
|
727
|
+
# but only when the match starts at a separator boundary (-, _, /, ., @)
|
|
704
728
|
# or covers the entire ref. This prevents "2" from matching "3.02".
|
|
705
729
|
# e.g. input "stable202002" matches branch "edk2-stable202002" (boundary: '-')
|
|
706
|
-
|
|
730
|
+
# e.g. input "0.3.6" matches tag "@serenityjs/logger@0.3.6" (boundary: '@')
|
|
731
|
+
_BOUNDARY_CHARS = {'-', '_', '/', '.', '@'}
|
|
707
732
|
base_lower = base.lower()
|
|
708
733
|
containing_refs = []
|
|
709
734
|
for r in ref_set:
|
|
@@ -53,6 +53,63 @@ def test_clarified_version_from_repo_prefixed_tag():
|
|
|
53
53
|
assert clarified_version_from_oss_version("freezed-v2.4.4") == "2.4.4"
|
|
54
54
|
|
|
55
55
|
|
|
56
|
+
def test_clarified_version_keeps_leading_zero_major():
|
|
57
|
+
assert clarified_version_from_oss_version("0.3.6") == "0.3.6"
|
|
58
|
+
assert clarified_version_from_oss_version("v0.3.6") == "0.3.6"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_decide_checkout_clarified_keeps_leading_zero_major(monkeypatch):
|
|
62
|
+
tags = ["0.3.6", "v0.3.6"]
|
|
63
|
+
monkeypatch.setattr(
|
|
64
|
+
"fosslight_util.download.get_remote_refs",
|
|
65
|
+
lambda _url: {"tags": tags, "branches": ["master"]},
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
ref, clar = decide_checkout(
|
|
69
|
+
checkout_to="0.3.6",
|
|
70
|
+
git_url="https://github.com/example/pkg",
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
assert ref in ("0.3.6", "v0.3.6")
|
|
74
|
+
assert clar == "0.3.6"
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_try_resolve_npm_scoped_package_tag():
|
|
78
|
+
ref_set = {
|
|
79
|
+
"@serenityjs/logger@0.3.5",
|
|
80
|
+
"@serenityjs/logger@0.3.6",
|
|
81
|
+
"@serenityjs/protocol@0.3.6",
|
|
82
|
+
"master",
|
|
83
|
+
}
|
|
84
|
+
ref, clar = _try_resolve_checkout_base("0.3.6", ref_set)
|
|
85
|
+
assert ref == "@serenityjs/logger@0.3.6"
|
|
86
|
+
assert clar == "0.3.6"
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_decide_checkout_resolves_npm_scoped_package_tag(monkeypatch):
|
|
90
|
+
tags = [
|
|
91
|
+
"@serenityjs/logger@0.3.5",
|
|
92
|
+
"@serenityjs/logger@0.3.6",
|
|
93
|
+
"@serenityjs/protocol@0.4.0",
|
|
94
|
+
]
|
|
95
|
+
monkeypatch.setattr(
|
|
96
|
+
"fosslight_util.download.get_remote_refs",
|
|
97
|
+
lambda _url: {"tags": tags, "branches": ["main"]},
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
ref, clar = decide_checkout(
|
|
101
|
+
checkout_to="0.3.6",
|
|
102
|
+
git_url="https://github.com/SerenityJS/serenity",
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
assert ref == "@serenityjs/logger@0.3.6"
|
|
106
|
+
assert clar == "0.3.6"
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_clarified_version_from_npm_scoped_tag():
|
|
110
|
+
assert clarified_version_from_oss_version("@serenityjs/logger@0.3.6") == "0.3.6"
|
|
111
|
+
|
|
112
|
+
|
|
56
113
|
def test_decide_checkout_resolves_repo_prefixed_tag(monkeypatch):
|
|
57
114
|
tags = ["freezed-v2.4.4", "freezed_annotation-v2.4.4"]
|
|
58
115
|
monkeypatch.setattr(
|
|
@@ -78,6 +78,17 @@ from fosslight_util import _get_downloadable_url as downloadable_url
|
|
|
78
78
|
"/wrong/path.txt",
|
|
79
79
|
"1.0.190",
|
|
80
80
|
),
|
|
81
|
+
# Archive basename with no version must not become oss_version
|
|
82
|
+
(
|
|
83
|
+
"https://web.archive.org/web/20160315015917/http://www.sparetimelabs.com/tinyprintf/printf.zip",
|
|
84
|
+
"/tmp/printf.zip",
|
|
85
|
+
"",
|
|
86
|
+
),
|
|
87
|
+
(
|
|
88
|
+
"https://example.com/files/printf.zip",
|
|
89
|
+
"",
|
|
90
|
+
"",
|
|
91
|
+
),
|
|
81
92
|
],
|
|
82
93
|
)
|
|
83
94
|
def test_oss_version_hint_from_wget_link(link, downloaded_file, expected_hint):
|
|
@@ -89,6 +100,8 @@ def test_oss_version_hint_from_wget_link(link, downloaded_file, expected_hint):
|
|
|
89
100
|
"hint,expected_clarified",
|
|
90
101
|
[
|
|
91
102
|
("0.2.3", "0.2.3"),
|
|
103
|
+
("0.3.6", "0.3.6"),
|
|
104
|
+
("v0.3.6", "0.3.6"),
|
|
92
105
|
("3.8.2", "3.8.2"),
|
|
93
106
|
("2.31.0", "2.31.0"),
|
|
94
107
|
("4.17.21", "4.17.21"),
|
|
@@ -98,6 +111,13 @@ def test_oss_version_hint_from_wget_link(link, downloaded_file, expected_hint):
|
|
|
98
111
|
("v3.28.3", "3.28.3"),
|
|
99
112
|
("4:10.2.1-1", "10.2.1"),
|
|
100
113
|
("1:3.118+deb11u1", "3.118"),
|
|
114
|
+
# Embedded three-part versions must not collapse to trailing x.y
|
|
115
|
+
("R0.3.6", "0.3.6"),
|
|
116
|
+
("rel0.3.6", "0.3.6"),
|
|
117
|
+
("@serenityjs/logger@0.3.6", "0.3.6"),
|
|
118
|
+
("1.2.3", "1.2.3"),
|
|
119
|
+
("0.3", "0.3"),
|
|
120
|
+
("foo-1.2", "1.2"),
|
|
101
121
|
],
|
|
102
122
|
)
|
|
103
123
|
def test_clarified_follows_hint_for_semver(hint, expected_clarified):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util/resources/frequentLicenselist.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_util-2.2.4 → fosslight_util-2.2.5}/src/fosslight_util.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|