Skip to content

Commit 4f5733d

Browse files
authored
Merge branch 'main' into click
2 parents 1ce7ba1 + 8efa9ff commit 4f5733d

File tree

13 files changed

+239
-99
lines changed

13 files changed

+239
-99
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
commit = True
33
tag = False
44
message = Bump version: {current_version} → {new_version}
5-
current_version = 2.1.7
5+
current_version = 2.1.13
66

77
[bumpversion:file:setup.py]
88
search = '{current_version}'

.github/workflows/publish-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: Set up Python
6161
uses: actions/setup-python@v4
6262
with:
63-
python-version: '3.8'
63+
python-version: '3.10'
6464
- name: Install dependencies
6565
run: |
6666
python -m pip install --upgrade pip

.github/workflows/pull-request.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
build:
1717
strategy:
1818
matrix:
19-
python-version: [3.8, 3.11]
19+
python-version: ["3.11"]
2020
os: [ubuntu-latest, windows-latest]
2121
runs-on: ${{ matrix.os }}
2222
steps:
@@ -35,7 +35,7 @@ jobs:
3535
build_macos:
3636
strategy:
3737
matrix:
38-
python-version: [3.9, 3.11]
38+
python-version: ["3.11"]
3939
runs-on: macos-latest
4040
steps:
4141
- uses: actions/checkout@v3
@@ -45,7 +45,9 @@ jobs:
4545
python-version: ${{ matrix.python-version }}
4646
- name: Install dependencies
4747
run: |
48-
brew install openssl
48+
if ! brew list openssl@3 &>/dev/null; then
49+
brew install openssl@3
50+
fi
4951
brew install libmagic
5052
brew install postgresql
5153
python -m pip install --upgrade pip

CHANGELOG.md

Lines changed: 56 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
11
# Changelog
22

3+
## v2.1.13 (10/09/2025)
4+
## Changes
5+
## 🔧 Maintenance
6+
7+
- Add is_manifest_file field @dd-jy (#215)
8+
9+
---
10+
11+
## v2.1.12 (21/08/2025)
12+
## Changes
13+
## 🚀 Features
14+
15+
- Exclude package dirs with directory name @dd-jy (#214)
16+
17+
## 🔧 Maintenance
18+
19+
- Fix scancode version for Mac @JustinWonjaePark (#213)
20+
21+
---
22+
23+
## v2.1.11 (21/07/2025)
24+
## Changes
25+
## 🔧 Maintenance
26+
27+
- Remove copyright info for license text file of GPL family @JustinWonjaePark (#212)
28+
29+
---
30+
31+
## v2.1.10 (17/07/2025)
32+
## Changes
33+
- Recognize manifest file as License File @JustinWonjaePark (#210)
34+
35+
## 🔧 Maintenance
36+
37+
- Update Python support to 3.10+ and remove scanners' version limits @JustinWonjaePark (#211)
38+
39+
---
40+
41+
## v2.1.9 (10/07/2025)
42+
## Changes
43+
- Remove copyright from SCANOSS result @JustinWonjaePark (#209)
44+
45+
## 🔧 Maintenance
46+
47+
- Fix github action warning message @bjk7119 (#208)
48+
49+
---
50+
51+
## v2.1.8 (09/04/2025)
52+
## Changes
53+
## 🔧 Maintenance
54+
55+
- Fix api_limit_exceed_parameter @JustinWonjaePark (#206)
56+
57+
---
58+
359
## v2.1.7 (26/02/2025)
460
## Changes
561
## 🔧 Maintenance
@@ -239,71 +295,3 @@
239295
## 🐛 Hotfixes
240296

241297
- Fix vulnerability from requirements.txt @JustinWonjaePark (#138)
242-
243-
---
244-
245-
## v1.7.1 (31/08/2023)
246-
## Changes
247-
## 🔧 Maintenance
248-
249-
- Priority change between Download Location extraction and scanner operation @JustinWonjaePark (#133)
250-
251-
---
252-
253-
## v1.7.0 (14/08/2023)
254-
## Changes
255-
- Fix the bug when nothing is detected @soimkim (#134)
256-
257-
## 🚀 Features
258-
259-
- Load v32 and later of ScanCode @soimkim (#131)
260-
261-
## 🔧 Maintenance
262-
263-
- Fix the scancdoe and util version @dd-jy (#132)
264-
265-
---
266-
267-
## v1.6.32 (03/08/2023)
268-
## Changes
269-
## 🐛 Hotfixes
270-
271-
- Fix the util version @dd-jy (#130)
272-
273-
---
274-
275-
## v1.6.31 (03/08/2023)
276-
## Changes
277-
## 🐛 Hotfixes
278-
279-
- Revert the scancode-toolkit version @dd-jy (#129)
280-
281-
## 🔧 Maintenance
282-
283-
- Remove sorting @JustinWonjaePark (#128)
284-
285-
---
286-
287-
## v1.6.30 (25/07/2023)
288-
## Changes
289-
## 🔧 Maintenance
290-
291-
- Update scancode-toolkit version @dd-jy (#127)
292-
293-
---
294-
295-
## v1.6.29 (25/07/2023)
296-
## Changes
297-
## 🚀 Features
298-
299-
- Read download location @JustinWonjaePark (#124)
300-
301-
## 🐛 Hotfixes
302-
303-
- Update FOSSLight Util version @soimkim (#126)
304-
305-
## 🔧 Maintenance
306-
307-
- Sort the result by file and exclude attributes @JustinWonjaePark (#125)
308-
- Update the minimum version of util @dd-jy (#123)
309-
- Change the default path to find sbom-info.yaml @dd-jy (#122)

requirements-dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ tox
22
pytest
33
pytest-cov
44
pytest-flake8
5-
flake8==3.9.2
5+
flake8
66
dataclasses
77
scanoss
8-
importlib-metadata==4.12.0
8+
importlib-metadata
99
pytest-xdist

requirements.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ PyYAML
66
wheel>=0.38.1
77
intbitset
88
fosslight_binary>=5.0.0
9-
scancode-toolkit==32.0.*;sys_platform=="darwin"
10-
scancode-toolkit==32.2.*;sys_platform!="darwin"
11-
psycopg2-binary==2.9.9
12-
beautifulsoup4==4.12.*
9+
scancode-toolkit>=32.0.2
10+
fingerprints==1.2.3
11+
normality==2.6.1
1312
click==8.2.1

setup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
if __name__ == "__main__":
1515
setup(
1616
name='fosslight_source',
17-
version='2.1.7',
17+
version='2.1.13',
1818
package_dir={"": "src"},
1919
packages=find_packages(where='src'),
2020
description='FOSSLight Source Scanner',
@@ -26,11 +26,10 @@
2626
download_url='https://github.com/fosslight/fosslight_source_scanner',
2727
classifiers=['License :: OSI Approved :: Apache Software License',
2828
"Programming Language :: Python :: 3",
29-
"Programming Language :: Python :: 3.8",
30-
"Programming Language :: Python :: 3.9",
3129
"Programming Language :: Python :: 3.10",
32-
"Programming Language :: Python :: 3.11", ],
33-
python_requires=">=3.8",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12", ],
32+
python_requires=">=3.10, <3.13",
3433
install_requires=required,
3534
entry_points={
3635
"console_scripts": [

src/fosslight_source/_parsing_scancode_file_item.py

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from ._scan_item import is_exclude_file
1414
from ._scan_item import replace_word
1515
from ._scan_item import is_notice_file
16+
from ._scan_item import is_manifest_file
17+
from ._scan_item import is_package_dir
1618
from typing import Tuple
1719

1820
logger = logging.getLogger(constant.LOGGER_NAME)
@@ -29,6 +31,27 @@
2931
SPDX_REPLACE_WORDS = ["(", ")"]
3032
KEY_AND = r"(?<=\s)and(?=\s)"
3133
KEY_OR = r"(?<=\s)or(?=\s)"
34+
GPL_LICENSE_PATTERN = r'((a|l)?gpl|gfdl)' # GPL, LGPL, AGPL, GFDL
35+
36+
37+
def is_gpl_family_license(licenses: list) -> bool:
38+
if not licenses:
39+
return False
40+
41+
for license_name in licenses:
42+
if not license_name:
43+
continue
44+
45+
license_lower = license_name.lower()
46+
if re.search(GPL_LICENSE_PATTERN, license_lower):
47+
logger.debug(f"GPL family license detected: {license_name}")
48+
return True
49+
50+
return False
51+
52+
53+
def should_remove_copyright_for_gpl_license_text(licenses: list, is_license_text: bool) -> bool:
54+
return is_license_text and is_gpl_family_license(licenses)
3255

3356

3457
def get_error_from_header(header_item: list) -> Tuple[bool, str]:
@@ -77,6 +100,13 @@ def parsing_scancode_32_earlier(scancode_file_list: list, has_error: bool = Fals
77100
copyright_list = file.get("copyrights", [])
78101

79102
result_item = SourceItem(file_path)
103+
is_pkg, pkg_path = is_package_dir(os.path.dirname(file_path))
104+
if is_pkg:
105+
result_item.source_name_or_path = pkg_path
106+
if not any(x.source_name_or_path == result_item.source_name_or_path for x in scancode_file_item):
107+
result_item.exclude = True
108+
scancode_file_item.append(result_item)
109+
continue
80110

81111
if has_error and "scan_errors" in file:
82112
error_msg = file.get("scan_errors", [])
@@ -99,8 +129,6 @@ def parsing_scancode_32_earlier(scancode_file_list: list, has_error: bool = Fals
99129
pass
100130
copyright_value_list.append(copyright_data)
101131

102-
result_item.copyright = copyright_value_list
103-
104132
# Set the license value
105133
license_detected = []
106134
if licenses is None or licenses == "":
@@ -164,6 +192,16 @@ def parsing_scancode_32_earlier(scancode_file_list: list, has_error: bool = Fals
164192
if len(license_detected) > 0:
165193
result_item.licenses = license_detected
166194

195+
if is_manifest_file(file_path):
196+
result_item.is_manifest_file = True
197+
198+
# Remove copyright info for license text file of GPL family
199+
if should_remove_copyright_for_gpl_license_text(license_detected, result_item.is_license_text):
200+
logger.debug(f"Removing copyright for GPL family license text file: {file_path}")
201+
result_item.copyright = []
202+
else:
203+
result_item.copyright = copyright_value_list
204+
167205
if len(license_expression_list) > 0:
168206
license_expression_list = list(
169207
set(license_expression_list))
@@ -205,6 +243,13 @@ def parsing_scancode_32_later(
205243
continue
206244

207245
result_item = SourceItem(file_path)
246+
is_pkg, pkg_path = is_package_dir(os.path.dirname(file_path))
247+
if is_pkg:
248+
result_item.source_name_or_path = pkg_path
249+
if not any(x.source_name_or_path == result_item.source_name_or_path for x in scancode_file_item):
250+
result_item.exclude = True
251+
scancode_file_item.append(result_item)
252+
continue
208253

209254
if has_error:
210255
error_msg = file.get("scan_errors", [])
@@ -223,7 +268,6 @@ def parsing_scancode_32_later(
223268
except Exception:
224269
pass
225270
copyright_value_list.append(copyright_data)
226-
result_item.copyright = copyright_value_list
227271

228272
license_detected = []
229273
licenses = file.get("license_detections", [])
@@ -259,6 +303,20 @@ def parsing_scancode_32_later(
259303
license_list[lic_matched_key] = lic_info
260304
license_detected.append(found_lic)
261305
result_item.licenses = license_detected
306+
307+
result_item.exclude = is_exclude_file(file_path)
308+
result_item.is_license_text = file.get("percentage_of_license_text", 0) > 90 or is_notice_file(file_path)
309+
310+
if is_manifest_file(file_path) and len(license_detected) > 0:
311+
result_item.is_manifest_file = True
312+
313+
# Remove copyright info for license text file of GPL family
314+
if should_remove_copyright_for_gpl_license_text(license_detected, result_item.is_license_text):
315+
logger.debug(f"Removing copyright for GPL family license text file: {file_path}")
316+
result_item.copyright = []
317+
else:
318+
result_item.copyright = copyright_value_list
319+
262320
if len(license_detected) > 1:
263321
license_expression_spdx = file.get("detected_license_expression_spdx", "")
264322
license_expression = file.get("detected_license_expression", "")
@@ -267,8 +325,6 @@ def parsing_scancode_32_later(
267325
if license_expression:
268326
result_item.comment = license_expression
269327

270-
result_item.exclude = is_exclude_file(file_path)
271-
result_item.is_license_text = file.get("percentage_of_license_text", 0) > 90 or is_notice_file(file_path)
272328
scancode_file_item.append(result_item)
273329
except Exception as ex:
274330
msg.append(f"Error Parsing item: {ex}")

src/fosslight_source/_parsing_scanoss_file.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import fosslight_util.constant as constant
99
from ._scan_item import SourceItem
1010
from ._scan_item import is_exclude_file
11+
from ._scan_item import is_package_dir
1112
from ._scan_item import replace_word
1213
from typing import Tuple
1314

@@ -45,6 +46,13 @@ def parsing_scanResult(scanoss_report: dict, path_to_scan: str = "", path_to_exc
4546
if any(os.path.commonpath([abs_file_path, exclude_path]) == exclude_path for exclude_path in abs_path_to_exclude):
4647
continue
4748
result_item = SourceItem(file_path)
49+
is_pkg, pkg_path = is_package_dir(os.path.dirname(file_path))
50+
if is_pkg:
51+
result_item.source_name_or_path = pkg_path
52+
if not any(x.source_name_or_path == result_item.source_name_or_path for x in scanoss_file_item):
53+
result_item.exclude = True
54+
scanoss_file_item.append(result_item)
55+
continue
4856

4957
if 'id' in findings[0]:
5058
if "none" == findings[0]['id']:
@@ -60,7 +68,6 @@ def parsing_scanResult(scanoss_report: dict, path_to_scan: str = "", path_to_exc
6068
license_detected = []
6169
license_w_source = {"component_declared": [], "file_spdx_tag": [],
6270
"file_header": [], "license_file": [], "scancode": []}
63-
copyright_detected = []
6471
if 'licenses' in findings[0]:
6572
for license in findings[0]['licenses']:
6673

@@ -78,11 +85,6 @@ def parsing_scanResult(scanoss_report: dict, path_to_scan: str = "", path_to_exc
7885
if len(license_detected) > 0:
7986
result_item.licenses = license_detected
8087
result_item.scanoss_reference = license_w_source
81-
if 'copyrights' in findings[0]:
82-
for copyright in findings[0]['copyrights']:
83-
copyright_detected.append(copyright['name'])
84-
if len(copyright_detected) > 0:
85-
result_item.copyright = copyright_detected
8688

8789
if is_exclude_file(file_path):
8890
result_item.exclude = True

0 commit comments

Comments
 (0)