fosslight-source 2.2.7__tar.gz → 2.2.9__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_source-2.2.7/src/fosslight_source.egg-info → fosslight_source-2.2.9}/PKG-INFO +1 -1
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/setup.py +1 -1
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/_parsing_scancode_file_item.py +17 -2
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/_scan_item.py +8 -8
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/cli.py +7 -4
- {fosslight_source-2.2.7 → fosslight_source-2.2.9/src/fosslight_source.egg-info}/PKG-INFO +1 -1
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/LICENSE +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/MANIFEST.in +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/README.md +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/requirements.txt +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/setup.cfg +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/__init__.py +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/_help.py +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/_license_matched.py +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/_parsing_scanoss_file.py +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/run_manifest_extractor.py +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/run_scancode.py +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/run_scanoss.py +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/run_spdx_extractor.py +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source.egg-info/SOURCES.txt +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source.egg-info/dependency_links.txt +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source.egg-info/entry_points.txt +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source.egg-info/requires.txt +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source.egg-info/top_level.txt +0 -0
- {fosslight_source-2.2.7 → fosslight_source-2.2.9}/tests/test_tox.py +0 -0
|
@@ -14,7 +14,7 @@ with open('requirements.txt', 'r', 'utf-8') as f:
|
|
|
14
14
|
if __name__ == "__main__":
|
|
15
15
|
setup(
|
|
16
16
|
name='fosslight_source',
|
|
17
|
-
version='2.2.
|
|
17
|
+
version='2.2.9',
|
|
18
18
|
package_dir={"": "src"},
|
|
19
19
|
packages=find_packages(where='src'),
|
|
20
20
|
description='FOSSLight Source Scanner',
|
|
@@ -207,6 +207,21 @@ def split_spdx_expression(spdx_string: str) -> list:
|
|
|
207
207
|
return license
|
|
208
208
|
|
|
209
209
|
|
|
210
|
+
def get_license_expression_spdx(license_expression: str) -> str:
|
|
211
|
+
if not license_expression or not license_expression.strip():
|
|
212
|
+
return ""
|
|
213
|
+
try:
|
|
214
|
+
from licensedcode.cache import build_spdx_license_expression
|
|
215
|
+
result = build_spdx_license_expression(license_expression.strip())
|
|
216
|
+
if result is None:
|
|
217
|
+
return ""
|
|
218
|
+
if regex.match(result):
|
|
219
|
+
return ""
|
|
220
|
+
return result
|
|
221
|
+
except Exception:
|
|
222
|
+
return ""
|
|
223
|
+
|
|
224
|
+
|
|
210
225
|
def parsing_scancode_32_later(
|
|
211
226
|
scancode_file_list: list, has_error: bool = False
|
|
212
227
|
) -> Tuple[bool, list, list, dict]:
|
|
@@ -231,7 +246,6 @@ def parsing_scancode_32_later(
|
|
|
231
246
|
result_item.comment = ",".join(error_msg)
|
|
232
247
|
scancode_file_item.append(result_item)
|
|
233
248
|
continue
|
|
234
|
-
|
|
235
249
|
copyright_value_list = []
|
|
236
250
|
for x in file.get("copyrights", []):
|
|
237
251
|
copyright_data = x.get("copyright", "")
|
|
@@ -242,7 +256,6 @@ def parsing_scancode_32_later(
|
|
|
242
256
|
except Exception:
|
|
243
257
|
pass
|
|
244
258
|
copyright_value_list.append(copyright_data)
|
|
245
|
-
|
|
246
259
|
license_detected = []
|
|
247
260
|
licenses = file.get("license_detections", [])
|
|
248
261
|
if not licenses:
|
|
@@ -266,6 +279,8 @@ def parsing_scancode_32_later(
|
|
|
266
279
|
found_lic = str(matched.group())
|
|
267
280
|
except Exception:
|
|
268
281
|
pass
|
|
282
|
+
license_expression_spdx = get_license_expression_spdx(found_lic)
|
|
283
|
+
found_lic = license_expression_spdx if license_expression_spdx else found_lic
|
|
269
284
|
for word in replace_word:
|
|
270
285
|
found_lic = found_lic.replace(word, "")
|
|
271
286
|
if matched_txt:
|
|
@@ -23,7 +23,7 @@ _manifest_filename = [r'.*\.pom$', r'package\.json$', r'setup\.py$', r'setup\.cf
|
|
|
23
23
|
MAX_LICENSE_LENGTH = 200
|
|
24
24
|
MAX_LICENSE_TOTAL_LENGTH = 600
|
|
25
25
|
SUBSTRING_LICENSE_COMMENT = "Maximum character limit (License)"
|
|
26
|
-
KB_URL = "http://fosslight-kb.lge.com/
|
|
26
|
+
KB_URL = "http://fosslight-kb.lge.com/"
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class SourceItem(FileItem):
|
|
@@ -96,11 +96,11 @@ class SourceItem(FileItem):
|
|
|
96
96
|
except Exception as e:
|
|
97
97
|
logger.debug(f"Failed to get WFP for {self.source_name_or_path}: {e}")
|
|
98
98
|
except FileNotFoundError:
|
|
99
|
-
logger.
|
|
99
|
+
logger.debug(f"File not found: {self.source_name_or_path}")
|
|
100
100
|
except PermissionError:
|
|
101
|
-
logger.
|
|
101
|
+
logger.debug(f"Permission denied: {self.source_name_or_path}")
|
|
102
102
|
except Exception as e:
|
|
103
|
-
logger.
|
|
103
|
+
logger.debug(f"Failed to compute MD5 for {self.source_name_or_path}: {e}")
|
|
104
104
|
return md5_hex, wfp
|
|
105
105
|
|
|
106
106
|
def _get_origin_url_from_md5_hash(self, md5_hash: str, wfp: str = "") -> str:
|
|
@@ -108,7 +108,7 @@ class SourceItem(FileItem):
|
|
|
108
108
|
payload = {"file_hash": md5_hash}
|
|
109
109
|
if wfp and wfp.strip():
|
|
110
110
|
payload["wfp_base64"] = base64.b64encode(wfp.strip().encode("utf-8")).decode("ascii")
|
|
111
|
-
request = urllib.request.Request(KB_URL, data=json.dumps(payload).encode('utf-8'), method='POST')
|
|
111
|
+
request = urllib.request.Request(f"{KB_URL}query", data=json.dumps(payload).encode('utf-8'), method='POST')
|
|
112
112
|
request.add_header('Accept', 'application/json')
|
|
113
113
|
request.add_header('Content-Type', 'application/json')
|
|
114
114
|
|
|
@@ -122,11 +122,11 @@ class SourceItem(FileItem):
|
|
|
122
122
|
if output:
|
|
123
123
|
return output
|
|
124
124
|
except urllib.error.URLError as e:
|
|
125
|
-
logger.
|
|
125
|
+
logger.debug(f"Failed to fetch origin_url from API for MD5 hash {md5_hash}: {e}")
|
|
126
126
|
except json.JSONDecodeError as e:
|
|
127
|
-
logger.
|
|
127
|
+
logger.debug(f"Failed to parse API response for MD5 hash {md5_hash}: {e}")
|
|
128
128
|
except Exception as e:
|
|
129
|
-
logger.
|
|
129
|
+
logger.debug(f"Error getting origin_url for MD5 hash {md5_hash}: {e}")
|
|
130
130
|
return ""
|
|
131
131
|
|
|
132
132
|
def _extract_oss_info_from_url(self, url: str) -> tuple:
|
|
@@ -263,15 +263,18 @@ def create_report_file(
|
|
|
263
263
|
|
|
264
264
|
def check_kb_server_reachable() -> bool:
|
|
265
265
|
try:
|
|
266
|
-
request = urllib.request.Request(KB_URL, method='
|
|
267
|
-
with urllib.request.urlopen(request, timeout=
|
|
266
|
+
request = urllib.request.Request(f"{KB_URL}health", method='GET')
|
|
267
|
+
with urllib.request.urlopen(request, timeout=10) as response:
|
|
268
268
|
logger.debug(f"KB server is reachable. Response status: {response.status}")
|
|
269
269
|
return response.status != 404
|
|
270
270
|
except urllib.error.HTTPError as e:
|
|
271
|
+
logger.debug(f"KB server returned HTTP error: {e.code}")
|
|
271
272
|
return e.code != 404
|
|
272
|
-
except urllib.error.URLError:
|
|
273
|
+
except urllib.error.URLError as e:
|
|
274
|
+
logger.debug(f"KB server is unreachable (timeout or connection error): {e}")
|
|
273
275
|
return False
|
|
274
|
-
except Exception:
|
|
276
|
+
except Exception as e:
|
|
277
|
+
logger.debug(f"Unexpected error checking KB server: {e}")
|
|
275
278
|
return False
|
|
276
279
|
|
|
277
280
|
|
|
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_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/_parsing_scanoss_file.py
RENAMED
|
File without changes
|
{fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/run_manifest_extractor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source/run_spdx_extractor.py
RENAMED
|
File without changes
|
|
File without changes
|
{fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source.egg-info/requires.txt
RENAMED
|
File without changes
|
{fosslight_source-2.2.7 → fosslight_source-2.2.9}/src/fosslight_source.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|