fosslight-util 2.1.35__tar.gz → 2.1.37__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.1.35/src/fosslight_util.egg-info → fosslight_util-2.1.37}/PKG-INFO +1 -1
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/setup.py +1 -1
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/exclude.py +22 -10
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/get_pom_license.py +33 -2
- {fosslight_util-2.1.35 → fosslight_util-2.1.37/src/fosslight_util.egg-info}/PKG-INFO +1 -1
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/LICENSE +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/MANIFEST.in +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/README.md +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/requirements.txt +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/setup.cfg +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/__init__.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/_get_downloadable_url.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/compare_yaml.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/constant.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/correct.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/cover.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/download.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/help.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/oss_item.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/output_format.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/parsing_yaml.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/read_excel.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/resources/frequentLicenselist.json +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/resources/frequent_license_nick_list.json +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/resources/licenses.json +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/set_log.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/spdx_licenses.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/timer_thread.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/write_cyclonedx.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/write_excel.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/write_opossum.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/write_scancodejson.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/write_spdx.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/write_txt.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util/write_yaml.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util.egg-info/SOURCES.txt +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util.egg-info/dependency_links.txt +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util.egg-info/entry_points.txt +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util.egg-info/requires.txt +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/src/fosslight_util.egg-info/top_level.txt +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/tests/test_cyclonedx.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/tests/test_download.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/tests/test_opossum.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/tests/test_spdx_licenses.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/tests/test_text.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/tests/test_write_output.py +0 -0
- {fosslight_util-2.1.35 → fosslight_util-2.1.37}/tests/test_write_yaml.py +0 -0
|
@@ -7,8 +7,14 @@ import os
|
|
|
7
7
|
import fnmatch
|
|
8
8
|
from typing import List
|
|
9
9
|
|
|
10
|
-
EXCLUDE_DIRECTORY = ["test", "tests", "doc", "docs"]
|
|
10
|
+
EXCLUDE_DIRECTORY = ["test", "tests", "doc", "docs", "intermediates"]
|
|
11
11
|
PACKAGE_DIRECTORY = ["node_modules", "venv", "Pods", "Carthage"]
|
|
12
|
+
EXCLUDE_FILENAME = ["changelog", "config.guess", "config.sub", "changes", "ltmain.sh",
|
|
13
|
+
"configure", "configure.ac", "depcomp", "compile", "missing", "makefile",
|
|
14
|
+
'fosslight_bin', 'fosslight_bin.exe']
|
|
15
|
+
EXCLUDE_FILE_EXTENSION = ['qm', 'xlsx', 'pdf', 'pptx', 'jfif', 'docx', 'doc', 'whl',
|
|
16
|
+
'xls', 'xlsm', 'ppt', 'mp4', 'pyc', 'plist', 'dat',
|
|
17
|
+
"m4", "in", "po", "class"]
|
|
12
18
|
|
|
13
19
|
|
|
14
20
|
def excluding_files(patterns: List[str], path_to_scan: str) -> List[str]:
|
|
@@ -98,13 +104,12 @@ def is_exclude_dir(rel_path: str) -> tuple:
|
|
|
98
104
|
return False, False
|
|
99
105
|
|
|
100
106
|
|
|
101
|
-
def get_excluded_paths(path_to_scan: str, custom_excluded_paths: list = [],
|
|
107
|
+
def get_excluded_paths(path_to_scan: str, custom_excluded_paths: list = [], custom_exclude_extension: list = []) -> tuple:
|
|
102
108
|
path_to_exclude = []
|
|
103
109
|
path_to_exclude_with_dot = []
|
|
104
110
|
excluded_files = set() # Use set for O(1) operations
|
|
105
111
|
abs_path_to_scan = os.path.abspath(path_to_scan)
|
|
106
112
|
custom_excluded_normalized = [p.replace('\\', '/') for p in custom_excluded_paths]
|
|
107
|
-
exclude_extensions_lower = [ext.lower().lstrip('.') for ext in exclude_file_extension]
|
|
108
113
|
cnt_file_except_skipped = 0
|
|
109
114
|
|
|
110
115
|
for root, dirs, files in os.walk(path_to_scan):
|
|
@@ -124,23 +129,30 @@ def get_excluded_paths(path_to_scan: str, custom_excluded_paths: list = [], excl
|
|
|
124
129
|
file_path = os.path.join(root, file_name)
|
|
125
130
|
rel_path = os.path.relpath(file_path, abs_path_to_scan).replace('\\', '/')
|
|
126
131
|
should_exclude = False
|
|
127
|
-
|
|
132
|
+
except_info_sheet = False
|
|
128
133
|
if not _has_parent_in_exclude_list(rel_path, path_to_exclude):
|
|
134
|
+
file_ext = os.path.splitext(file_name)[1].lstrip('.').lower()
|
|
129
135
|
if rel_path in custom_excluded_normalized:
|
|
130
136
|
should_exclude = True
|
|
131
137
|
elif file_name in custom_excluded_normalized:
|
|
132
138
|
should_exclude = True
|
|
133
139
|
elif file_name.startswith('.'):
|
|
134
140
|
should_exclude = True
|
|
135
|
-
|
|
136
|
-
elif
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
except_info_sheet = True
|
|
142
|
+
elif file_ext and file_ext in custom_exclude_extension:
|
|
143
|
+
should_exclude = True
|
|
144
|
+
elif file_name.lower() in EXCLUDE_FILENAME:
|
|
145
|
+
should_exclude = True
|
|
146
|
+
except_info_sheet = True
|
|
147
|
+
cnt_file_except_skipped += 1
|
|
148
|
+
elif file_ext and file_ext in EXCLUDE_FILE_EXTENSION:
|
|
149
|
+
should_exclude = True
|
|
150
|
+
except_info_sheet = True
|
|
151
|
+
cnt_file_except_skipped += 1
|
|
140
152
|
|
|
141
153
|
if should_exclude:
|
|
142
154
|
path_to_exclude.append(rel_path)
|
|
143
|
-
if
|
|
155
|
+
if except_info_sheet:
|
|
144
156
|
path_to_exclude_with_dot.append(rel_path)
|
|
145
157
|
excluded_files.add(rel_path)
|
|
146
158
|
else:
|
|
@@ -8,6 +8,12 @@ import logging
|
|
|
8
8
|
import urllib.request
|
|
9
9
|
from urllib.error import URLError, HTTPError
|
|
10
10
|
from defusedxml.ElementTree import fromstring as xml_fromstring
|
|
11
|
+
import ssl
|
|
12
|
+
# certifi is optional: if unavailable, use the default SSL context
|
|
13
|
+
try:
|
|
14
|
+
import certifi # type: ignore
|
|
15
|
+
except Exception: # pragma: no cover - optional dependency
|
|
16
|
+
certifi = None
|
|
11
17
|
import fosslight_util.constant as constant
|
|
12
18
|
|
|
13
19
|
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
@@ -19,6 +25,15 @@ def get_license_from_pom(group_id: str = None,
|
|
|
19
25
|
pom_path: str = None,
|
|
20
26
|
check_parent: bool = True) -> str:
|
|
21
27
|
|
|
28
|
+
def get_ssl_context():
|
|
29
|
+
try:
|
|
30
|
+
if certifi is not None:
|
|
31
|
+
return ssl.create_default_context(cafile=certifi.where())
|
|
32
|
+
return ssl.create_default_context()
|
|
33
|
+
except Exception as e:
|
|
34
|
+
logger.debug(f"Failed to create SSL context: {e}")
|
|
35
|
+
return None
|
|
36
|
+
|
|
22
37
|
def build_urls(g, a, v):
|
|
23
38
|
group_path = g.replace('.', '/')
|
|
24
39
|
name = f"{a}-{v}.pom"
|
|
@@ -27,11 +42,25 @@ def get_license_from_pom(group_id: str = None,
|
|
|
27
42
|
return [repo1, google]
|
|
28
43
|
|
|
29
44
|
def fetch_pom(g, a, v):
|
|
45
|
+
ssl_ctx = get_ssl_context()
|
|
30
46
|
for url in build_urls(g, a, v):
|
|
31
47
|
try:
|
|
48
|
+
if ssl_ctx is not None:
|
|
49
|
+
with urllib.request.urlopen(url, context=ssl_ctx) as resp:
|
|
50
|
+
return resp.read().decode('utf-8')
|
|
32
51
|
with urllib.request.urlopen(url) as resp:
|
|
33
52
|
return resp.read().decode('utf-8')
|
|
34
|
-
except
|
|
53
|
+
except ssl.SSLError as e:
|
|
54
|
+
logger.warning(
|
|
55
|
+
f"SSL certificate verification failed for {url}. "
|
|
56
|
+
f"Please fix system certificates or use certifi. (error: {e})"
|
|
57
|
+
)
|
|
58
|
+
continue
|
|
59
|
+
except (HTTPError, URLError) as e:
|
|
60
|
+
logger.warning(f"Failed to fetch POM from {url}: {e}")
|
|
61
|
+
continue
|
|
62
|
+
except Exception as e:
|
|
63
|
+
logger.warning(f"Unexpected error fetching POM from {url}: {e}")
|
|
35
64
|
continue
|
|
36
65
|
return None
|
|
37
66
|
|
|
@@ -66,10 +95,12 @@ def get_license_from_pom(group_id: str = None,
|
|
|
66
95
|
visited.add(key)
|
|
67
96
|
content = fetch_pom(g, a, v)
|
|
68
97
|
if not content:
|
|
98
|
+
logger.warning(f"Failed to obtain POM content for {g}:{a}:{v} from remote sources.")
|
|
69
99
|
return ''
|
|
70
100
|
try:
|
|
71
101
|
root = xml_fromstring(content)
|
|
72
|
-
except Exception:
|
|
102
|
+
except Exception as e:
|
|
103
|
+
logger.warning(f"Failed to parse POM for {g}:{a}:{v}: {e}")
|
|
73
104
|
return ''
|
|
74
105
|
licenses = extract_licenses(root)
|
|
75
106
|
if licenses:
|
|
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
|
|
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.1.35 → fosslight_util-2.1.37}/src/fosslight_util.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{fosslight_util-2.1.35 → fosslight_util-2.1.37}/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
|