fosslight-util 2.2.14__tar.gz → 2.2.16__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.14/src/fosslight_util.egg-info → fosslight_util-2.2.16}/PKG-INFO +1 -1
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/pyproject.toml +1 -1
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/_get_downloadable_url.py +13 -11
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/download.py +209 -73
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/help.py +1 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/oss_item.py +4 -3
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/read_excel.py +1 -1
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/set_log.py +1 -1
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/spdx_licenses.py +2 -2
- {fosslight_util-2.2.14 → fosslight_util-2.2.16/src/fosslight_util.egg-info}/PKG-INFO +1 -1
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util.egg-info/SOURCES.txt +1 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_decide_checkout.py +0 -8
- fosslight_util-2.2.16/tests/test_download_timeout.py +543 -0
- fosslight_util-2.2.16/tests/test_spdx_licenses.py +42 -0
- fosslight_util-2.2.14/tests/test_spdx_licenses.py +0 -12
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/LICENSE +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/MANIFEST.in +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/README.md +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/setup.cfg +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/__init__.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/compare_yaml.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/constant.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/correct.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/cover.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/exclude.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/get_pom_license.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/output_format.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/parsing_yaml.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/resources/frequentLicenselist.json +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/resources/frequent_license_nick_list.json +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/resources/licenses.json +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/time.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/timer_thread.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/write_cyclonedx.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/write_excel.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/write_opossum.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/write_scancodejson.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/write_spdx.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/write_txt.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util/write_yaml.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util.egg-info/dependency_links.txt +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util.egg-info/entry_points.txt +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util.egg-info/requires.txt +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/src/fosslight_util.egg-info/top_level.txt +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_cyclonedx.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_download.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_download_maven.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_download_packagist.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_download_version_hint.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_opossum.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_text.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_write_excel_hidden_sheet.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_write_output.py +0 -0
- {fosslight_util-2.2.14 → fosslight_util-2.2.16}/tests/test_write_yaml.py +0 -0
|
@@ -37,6 +37,8 @@ MAVEN_REPOSITORY_BASES = (
|
|
|
37
37
|
MAVEN_SOURCE_CLASSIFIERS = ("sources", "source", "src")
|
|
38
38
|
# (connect, read) — keep probes snappy; dead hosts must not stall the CLI.
|
|
39
39
|
MAVEN_HTTP_TIMEOUT = (2, 2)
|
|
40
|
+
# Upper bound for the lookups below, so a stalled server cannot hold up a download.
|
|
41
|
+
_HTTP_TIMEOUT = 10
|
|
40
42
|
# groupPath prefix → try these hosts before the default popularity order.
|
|
41
43
|
_MAVEN_GROUP_REPO_HINTS = (
|
|
42
44
|
("io/confluent", ("https://packages.confluent.io/maven",)),
|
|
@@ -597,7 +599,7 @@ def get_latest_package_version(link, pkg_type, oss_name):
|
|
|
597
599
|
|
|
598
600
|
try:
|
|
599
601
|
if pkg_type in ['npm', 'npm2']:
|
|
600
|
-
npm_response = requests.get(f"https://registry.npmjs.org/{oss_name}")
|
|
602
|
+
npm_response = requests.get(f"https://registry.npmjs.org/{oss_name}", timeout=_HTTP_TIMEOUT)
|
|
601
603
|
if npm_response.status_code == 200:
|
|
602
604
|
find_version = npm_response.json().get("dist-tags", {}).get("latest")
|
|
603
605
|
elif pkg_type == 'pypi':
|
|
@@ -664,11 +666,11 @@ def get_latest_package_version(link, pkg_type, oss_name):
|
|
|
664
666
|
cand = versions[-1]
|
|
665
667
|
find_version = cand.get('versionKey', {}).get('version', '')
|
|
666
668
|
elif pkg_type == 'pub':
|
|
667
|
-
pub_response = requests.get(f'https://pub.dev/api/packages/{oss_name}')
|
|
669
|
+
pub_response = requests.get(f'https://pub.dev/api/packages/{oss_name}', timeout=_HTTP_TIMEOUT)
|
|
668
670
|
if pub_response.status_code == 200:
|
|
669
671
|
find_version = pub_response.json().get('latest').get('version')
|
|
670
672
|
elif pkg_type == 'go':
|
|
671
|
-
go_response = requests.get(f'https://proxy.golang.org/{oss_name}/@latest')
|
|
673
|
+
go_response = requests.get(f'https://proxy.golang.org/{oss_name}/@latest', timeout=_HTTP_TIMEOUT)
|
|
672
674
|
if go_response.status_code == 200:
|
|
673
675
|
find_version = go_response.json().get('Version')
|
|
674
676
|
if find_version.startswith('v'):
|
|
@@ -784,7 +786,7 @@ def get_download_location_for_cargo(link):
|
|
|
784
786
|
oss_version = dn_loc_re[0][1]
|
|
785
787
|
|
|
786
788
|
new_link = f'{host}/{oss_name}/{oss_version}/download'
|
|
787
|
-
res = urlopen(new_link)
|
|
789
|
+
res = urlopen(new_link, timeout=_HTTP_TIMEOUT)
|
|
788
790
|
if res.getcode() == 200:
|
|
789
791
|
ret = True
|
|
790
792
|
else:
|
|
@@ -812,7 +814,7 @@ def get_download_location_for_go(link):
|
|
|
812
814
|
|
|
813
815
|
new_link = f'{host}/{oss_name}/@v/{oss_version}.zip'
|
|
814
816
|
try:
|
|
815
|
-
res = urlopen(new_link)
|
|
817
|
+
res = urlopen(new_link, timeout=_HTTP_TIMEOUT)
|
|
816
818
|
if res.getcode() == 200:
|
|
817
819
|
ret = True
|
|
818
820
|
else:
|
|
@@ -829,7 +831,7 @@ def get_download_location_for_go(link):
|
|
|
829
831
|
def get_available_wheel_urls(name, version):
|
|
830
832
|
try:
|
|
831
833
|
api_url = f'https://pypi.org/pypi/{name}/{version}/json'
|
|
832
|
-
response = requests.get(api_url)
|
|
834
|
+
response = requests.get(api_url, timeout=_HTTP_TIMEOUT)
|
|
833
835
|
if response.status_code == 200:
|
|
834
836
|
data = response.json()
|
|
835
837
|
wheel_urls = []
|
|
@@ -863,7 +865,7 @@ def get_download_location_for_pypi(link):
|
|
|
863
865
|
# 1. Source distribution 시도
|
|
864
866
|
new_link = f'{host}/packages/source/{oss_name[0]}/{oss_name}/{oss_name}-{oss_version}.tar.gz'
|
|
865
867
|
try:
|
|
866
|
-
res = urlopen(new_link)
|
|
868
|
+
res = urlopen(new_link, timeout=_HTTP_TIMEOUT)
|
|
867
869
|
if res.getcode() == 200:
|
|
868
870
|
ret = True
|
|
869
871
|
return ret, new_link
|
|
@@ -871,7 +873,7 @@ def get_download_location_for_pypi(link):
|
|
|
871
873
|
oss_name = re.sub(r"[-]+", "_", oss_name)
|
|
872
874
|
new_link = f'{host}/packages/source/{oss_name[0]}/{oss_name}/{oss_name}-{oss_version}.tar.gz'
|
|
873
875
|
try:
|
|
874
|
-
res = urlopen(new_link)
|
|
876
|
+
res = urlopen(new_link, timeout=_HTTP_TIMEOUT)
|
|
875
877
|
if res.getcode() == 200:
|
|
876
878
|
ret = True
|
|
877
879
|
return ret, new_link
|
|
@@ -886,7 +888,7 @@ def get_download_location_for_pypi(link):
|
|
|
886
888
|
for wheel_url in wheel_urls:
|
|
887
889
|
if 'py3-none-any' in wheel_url or 'py2.py3-none-any' in wheel_url:
|
|
888
890
|
try:
|
|
889
|
-
res = urlopen(wheel_url)
|
|
891
|
+
res = urlopen(wheel_url, timeout=_HTTP_TIMEOUT)
|
|
890
892
|
if res.getcode() == 200:
|
|
891
893
|
ret = True
|
|
892
894
|
new_link = wheel_url
|
|
@@ -898,7 +900,7 @@ def get_download_location_for_pypi(link):
|
|
|
898
900
|
# Pure Python wheel이 없으면 첫 번째 wheel 시도
|
|
899
901
|
if wheel_urls:
|
|
900
902
|
try:
|
|
901
|
-
res = urlopen(wheel_urls[0])
|
|
903
|
+
res = urlopen(wheel_urls[0], timeout=_HTTP_TIMEOUT)
|
|
902
904
|
if res.getcode() == 200:
|
|
903
905
|
ret = True
|
|
904
906
|
new_link = wheel_urls[0]
|
|
@@ -1107,7 +1109,7 @@ def get_download_location_for_maven(link):
|
|
|
1107
1109
|
else:
|
|
1108
1110
|
raise Exception("not valid url for maven")
|
|
1109
1111
|
|
|
1110
|
-
html = urlopen(dn_loc).read().decode('utf8')
|
|
1112
|
+
html = urlopen(dn_loc, timeout=_HTTP_TIMEOUT).read().decode('utf8')
|
|
1111
1113
|
bs_obj = BeautifulSoup(html, 'html.parser')
|
|
1112
1114
|
|
|
1113
1115
|
file_name = dn_loc.split('/')[-2] + '-' + dn_loc.split('/')[-1] + '-sources.jar'
|