fosslight-util 2.2.15__tar.gz → 2.2.17__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.15/src/fosslight_util.egg-info → fosslight_util-2.2.17}/PKG-INFO +1 -1
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/pyproject.toml +1 -1
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/download.py +9 -7
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/spdx_licenses.py +2 -2
- {fosslight_util-2.2.15 → fosslight_util-2.2.17/src/fosslight_util.egg-info}/PKG-INFO +1 -1
- fosslight_util-2.2.17/tests/test_spdx_licenses.py +42 -0
- fosslight_util-2.2.15/tests/test_spdx_licenses.py +0 -12
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/LICENSE +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/MANIFEST.in +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/README.md +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/setup.cfg +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/__init__.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/_get_downloadable_url.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/compare_yaml.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/constant.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/correct.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/cover.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/exclude.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/get_pom_license.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/help.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/oss_item.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/output_format.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/parsing_yaml.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/read_excel.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/resources/frequentLicenselist.json +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/resources/frequent_license_nick_list.json +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/resources/licenses.json +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/set_log.py +1 -1
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/time.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/timer_thread.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/write_cyclonedx.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/write_excel.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/write_opossum.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/write_scancodejson.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/write_spdx.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/write_txt.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util/write_yaml.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util.egg-info/SOURCES.txt +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util.egg-info/dependency_links.txt +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util.egg-info/entry_points.txt +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util.egg-info/requires.txt +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util.egg-info/top_level.txt +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_cyclonedx.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_decide_checkout.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_download.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_download_maven.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_download_packagist.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_download_timeout.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_download_version_hint.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_opossum.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_text.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_write_excel_hidden_sheet.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_write_output.py +0 -0
- {fosslight_util-2.2.15 → fosslight_util-2.2.17}/tests/test_write_yaml.py +0 -0
|
@@ -514,7 +514,7 @@ def get_remote_refs(git_url: str):
|
|
|
514
514
|
cp = subprocess.run(
|
|
515
515
|
["git", "-c", "credential.helper=", "-c", "credential.helper=!",
|
|
516
516
|
"ls-remote", "--tags", "--heads", git_url],
|
|
517
|
-
env=env, capture_output=True, text=True, timeout=30,
|
|
517
|
+
env=env, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=30,
|
|
518
518
|
stdin=subprocess.DEVNULL)
|
|
519
519
|
if cp.returncode == 0:
|
|
520
520
|
for line in cp.stdout.splitlines():
|
|
@@ -1017,7 +1017,9 @@ def run_git_clone_with_size_guard(
|
|
|
1017
1017
|
env=env,
|
|
1018
1018
|
stdout=subprocess.PIPE,
|
|
1019
1019
|
stderr=subprocess.PIPE,
|
|
1020
|
-
|
|
1020
|
+
# git writes UTF-8. Without an explicit encoding a non-UTF-8 locale (cp949 on
|
|
1021
|
+
# Korean Windows) fails on a Hangul path and git's output is lost.
|
|
1022
|
+
text=True, encoding="utf-8", errors="replace",
|
|
1021
1023
|
stdin=subprocess.DEVNULL,
|
|
1022
1024
|
)
|
|
1023
1025
|
except Exception as e:
|
|
@@ -1292,7 +1294,7 @@ def _download_with_system_wget(url, target_dir, size_limit_gb=None):
|
|
|
1292
1294
|
],
|
|
1293
1295
|
stdout=subprocess.DEVNULL,
|
|
1294
1296
|
stderr=subprocess.PIPE,
|
|
1295
|
-
text=True,
|
|
1297
|
+
text=True, encoding="utf-8", errors="replace",
|
|
1296
1298
|
stdin=subprocess.DEVNULL,
|
|
1297
1299
|
)
|
|
1298
1300
|
except Exception as error:
|
|
@@ -1648,7 +1650,7 @@ def extract_rpm_payload(source_file: str, dest_path: str) -> bool:
|
|
|
1648
1650
|
stdin=p1.stdout,
|
|
1649
1651
|
cwd=dest_path,
|
|
1650
1652
|
capture_output=True,
|
|
1651
|
-
text=True,
|
|
1653
|
+
text=True, encoding="utf-8", errors="replace",
|
|
1652
1654
|
timeout=SIGNAL_TIMEOUT,
|
|
1653
1655
|
)
|
|
1654
1656
|
finally:
|
|
@@ -1688,7 +1690,7 @@ def extract_rpm_payload(source_file: str, dest_path: str) -> bool:
|
|
|
1688
1690
|
r = subprocess.run(
|
|
1689
1691
|
args,
|
|
1690
1692
|
capture_output=True,
|
|
1691
|
-
text=True,
|
|
1693
|
+
text=True, encoding="utf-8", errors="replace",
|
|
1692
1694
|
timeout=SIGNAL_TIMEOUT,
|
|
1693
1695
|
check=False,
|
|
1694
1696
|
)
|
|
@@ -1909,7 +1911,7 @@ def gem_download(link, target_dir, checkout_to):
|
|
|
1909
1911
|
fetch_cmd = ['gem', 'fetch', gem_name]
|
|
1910
1912
|
# On timeout check_output kills gem; the caller reports the expired deadline.
|
|
1911
1913
|
fetch_result = subprocess.check_output(
|
|
1912
|
-
fetch_cmd, universal_newlines=True,
|
|
1914
|
+
fetch_cmd, universal_newlines=True, encoding="utf-8", errors="replace",
|
|
1913
1915
|
timeout=_download_request_timeout(SIGNAL_TIMEOUT),
|
|
1914
1916
|
)
|
|
1915
1917
|
fetch_result = fetch_result.replace('\n', '').split(' ')[-1]
|
|
@@ -1919,7 +1921,7 @@ def gem_download(link, target_dir, checkout_to):
|
|
|
1919
1921
|
else:
|
|
1920
1922
|
# gem unpack
|
|
1921
1923
|
subprocess.check_output(
|
|
1922
|
-
['gem', 'unpack', downloaded_gem], universal_newlines=True,
|
|
1924
|
+
['gem', 'unpack', downloaded_gem], universal_newlines=True, encoding="utf-8", errors="replace",
|
|
1923
1925
|
timeout=_download_request_timeout(SIGNAL_TIMEOUT),
|
|
1924
1926
|
)
|
|
1925
1927
|
# move unpacked file to target directory
|
|
@@ -27,7 +27,7 @@ def get_license_from_nick():
|
|
|
27
27
|
|
|
28
28
|
file_withpath = os.path.join(base_dir, licenses_file)
|
|
29
29
|
try:
|
|
30
|
-
with open(file_withpath, 'r') as f:
|
|
30
|
+
with open(file_withpath, 'r', encoding='utf-8') as f:
|
|
31
31
|
licenses = json.load(f)
|
|
32
32
|
except Exception as ex:
|
|
33
33
|
print(f"Error to get license from json file : {ex}")
|
|
@@ -49,7 +49,7 @@ def get_spdx_licenses_json() -> Tuple[bool, str, str]:
|
|
|
49
49
|
|
|
50
50
|
file_withpath = os.path.join(base_dir, licenses_file)
|
|
51
51
|
try:
|
|
52
|
-
with open(file_withpath, 'r') as f:
|
|
52
|
+
with open(file_withpath, 'r', encoding='utf-8') as f:
|
|
53
53
|
licenses = json.load(f)
|
|
54
54
|
except Exception as e:
|
|
55
55
|
success = False
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Copyright (c) 2021 LG Electronics Inc.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import builtins
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
import fosslight_util.spdx_licenses as spdx_licenses
|
|
7
|
+
from fosslight_util.spdx_licenses import get_spdx_licenses_json, get_license_from_nick
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_get_spdx_licenses_json():
|
|
11
|
+
# when
|
|
12
|
+
success, _, licenses = get_spdx_licenses_json()
|
|
13
|
+
|
|
14
|
+
# then
|
|
15
|
+
assert success is True
|
|
16
|
+
assert len(licenses) > 0
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_resource_json_is_read_as_utf8_regardless_of_locale(monkeypatch):
|
|
20
|
+
# Without an explicit encoding open() uses the locale encoding (cp949 on Korean
|
|
21
|
+
# Windows), and licenses.json, which is UTF-8 with non-ASCII characters, failed to
|
|
22
|
+
# load. CI runs with a UTF-8 locale, so make an unspecified encoding mean ASCII.
|
|
23
|
+
real_open = builtins.open
|
|
24
|
+
opened_without_encoding = []
|
|
25
|
+
|
|
26
|
+
def open_with_non_utf8_locale(file, mode="r", *args, **kwargs):
|
|
27
|
+
if "b" not in mode and "encoding" not in kwargs:
|
|
28
|
+
opened_without_encoding.append(os.path.basename(file))
|
|
29
|
+
kwargs["encoding"] = "ascii"
|
|
30
|
+
return real_open(file, mode, *args, **kwargs)
|
|
31
|
+
|
|
32
|
+
monkeypatch.setattr(spdx_licenses, "open", open_with_non_utf8_locale, raising=False)
|
|
33
|
+
|
|
34
|
+
# when
|
|
35
|
+
success, error_msg, licenses = get_spdx_licenses_json()
|
|
36
|
+
nicks = get_license_from_nick()
|
|
37
|
+
|
|
38
|
+
# then
|
|
39
|
+
assert success is True, error_msg
|
|
40
|
+
assert len(licenses) > 0
|
|
41
|
+
assert len(nicks) > 0
|
|
42
|
+
assert opened_without_encoding == []
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2021 LG Electronics Inc.
|
|
2
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
from fosslight_util.spdx_licenses import get_spdx_licenses_json
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def test_get_spdx_licenses_json():
|
|
7
|
-
# when
|
|
8
|
-
success, _, licenses = get_spdx_licenses_json()
|
|
9
|
-
|
|
10
|
-
# then
|
|
11
|
-
assert success is True
|
|
12
|
-
assert len(licenses) > 0
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -115,6 +115,7 @@ def init_log(log_file: str, create_file: bool = True, stream_log_level: int = lo
|
|
|
115
115
|
|
|
116
116
|
def move_log_file(prev_log_path, final_log_path):
|
|
117
117
|
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
118
|
+
os.makedirs(os.path.dirname(final_log_path) or ".", exist_ok=True)
|
|
118
119
|
target_handler = None
|
|
119
120
|
|
|
120
121
|
prev_abs = os.path.abspath(prev_log_path)
|
|
@@ -126,7 +127,6 @@ def move_log_file(prev_log_path, final_log_path):
|
|
|
126
127
|
target_handler = handler
|
|
127
128
|
break
|
|
128
129
|
|
|
129
|
-
os.makedirs(os.path.dirname(final_log_path) or ".", exist_ok=True)
|
|
130
130
|
try:
|
|
131
131
|
shutil.move(prev_log_path, final_log_path)
|
|
132
132
|
new_handler = logging.FileHandler(final_log_path, mode='a', encoding="utf-8")
|
|
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.15 → fosslight_util-2.2.17}/src/fosslight_util.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{fosslight_util-2.2.15 → fosslight_util-2.2.17}/src/fosslight_util.egg-info/entry_points.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
|
|
File without changes
|
|
File without changes
|