fosslight-source 2.1.11__tar.gz → 2.1.13__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.
Files changed (23) hide show
  1. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/PKG-INFO +1 -1
  2. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/requirements.txt +3 -1
  3. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/setup.py +1 -1
  4. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/_parsing_scancode_file_item.py +17 -2
  5. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/_parsing_scanoss_file.py +8 -0
  6. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/_scan_item.py +12 -0
  7. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/run_scancode.py +2 -0
  8. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source.egg-info/PKG-INFO +1 -1
  9. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source.egg-info/requires.txt +3 -1
  10. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/LICENSE +0 -0
  11. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/MANIFEST.in +0 -0
  12. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/README.md +0 -0
  13. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/setup.cfg +0 -0
  14. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/__init__.py +0 -0
  15. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/_help.py +0 -0
  16. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/_license_matched.py +0 -0
  17. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/cli.py +0 -0
  18. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/run_scanoss.py +0 -0
  19. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source/run_spdx_extractor.py +0 -0
  20. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source.egg-info/SOURCES.txt +0 -0
  21. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source.egg-info/dependency_links.txt +0 -0
  22. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source.egg-info/entry_points.txt +0 -0
  23. {fosslight_source-2.1.11 → fosslight_source-2.1.13}/src/fosslight_source.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fosslight_source
3
- Version: 2.1.11
3
+ Version: 2.1.13
4
4
  Summary: FOSSLight Source Scanner
5
5
  Home-page: https://github.com/fosslight/fosslight_source_scanner
6
6
  Download-URL: https://github.com/fosslight/fosslight_source_scanner
@@ -6,4 +6,6 @@ PyYAML
6
6
  wheel>=0.38.1
7
7
  intbitset
8
8
  fosslight_binary>=5.0.0
9
- scancode-toolkit
9
+ scancode-toolkit>=32.0.2
10
+ fingerprints==1.2.3
11
+ normality==2.6.1
@@ -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.1.11',
17
+ version='2.1.13',
18
18
  package_dir={"": "src"},
19
19
  packages=find_packages(where='src'),
20
20
  description='FOSSLight Source Scanner',
@@ -14,6 +14,7 @@ from ._scan_item import is_exclude_file
14
14
  from ._scan_item import replace_word
15
15
  from ._scan_item import is_notice_file
16
16
  from ._scan_item import is_manifest_file
17
+ from ._scan_item import is_package_dir
17
18
  from typing import Tuple
18
19
 
19
20
  logger = logging.getLogger(constant.LOGGER_NAME)
@@ -99,6 +100,13 @@ def parsing_scancode_32_earlier(scancode_file_list: list, has_error: bool = Fals
99
100
  copyright_list = file.get("copyrights", [])
100
101
 
101
102
  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
102
110
 
103
111
  if has_error and "scan_errors" in file:
104
112
  error_msg = file.get("scan_errors", [])
@@ -185,7 +193,7 @@ def parsing_scancode_32_earlier(scancode_file_list: list, has_error: bool = Fals
185
193
  result_item.licenses = license_detected
186
194
 
187
195
  if is_manifest_file(file_path):
188
- result_item.is_license_text = True
196
+ result_item.is_manifest_file = True
189
197
 
190
198
  # Remove copyright info for license text file of GPL family
191
199
  if should_remove_copyright_for_gpl_license_text(license_detected, result_item.is_license_text):
@@ -235,6 +243,13 @@ def parsing_scancode_32_later(
235
243
  continue
236
244
 
237
245
  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
238
253
 
239
254
  if has_error:
240
255
  error_msg = file.get("scan_errors", [])
@@ -293,7 +308,7 @@ def parsing_scancode_32_later(
293
308
  result_item.is_license_text = file.get("percentage_of_license_text", 0) > 90 or is_notice_file(file_path)
294
309
 
295
310
  if is_manifest_file(file_path) and len(license_detected) > 0:
296
- result_item.is_license_text = True
311
+ result_item.is_manifest_file = True
297
312
 
298
313
  # Remove copyright info for license text file of GPL family
299
314
  if should_remove_copyright_for_gpl_license_text(license_detected, result_item.is_license_text):
@@ -8,6 +8,7 @@ import logging
8
8
  import fosslight_util.constant as constant
9
9
  from ._scan_item import SourceItem
10
10
  from ._scan_item import is_exclude_file
11
+ from ._scan_item import is_package_dir
11
12
  from ._scan_item import replace_word
12
13
  from typing import Tuple
13
14
 
@@ -45,6 +46,13 @@ def parsing_scanResult(scanoss_report: dict, path_to_scan: str = "", path_to_exc
45
46
  if any(os.path.commonpath([abs_file_path, exclude_path]) == exclude_path for exclude_path in abs_path_to_exclude):
46
47
  continue
47
48
  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
48
56
 
49
57
  if 'id' in findings[0]:
50
58
  if "none" == findings[0]['id']:
@@ -22,6 +22,7 @@ _exclude_directory = ["test", "tests", "doc", "docs"]
22
22
  _exclude_directory = [os.path.sep + dir_name +
23
23
  os.path.sep for dir_name in _exclude_directory]
24
24
  _exclude_directory.append("/.")
25
+ _package_directory = ["node_modules", "venv", "Pods", "Carthage"]
25
26
  MAX_LICENSE_LENGTH = 200
26
27
  MAX_LICENSE_TOTAL_LENGTH = 600
27
28
  SUBSTRING_LICENSE_COMMENT = "Maximum character limit (License)"
@@ -33,6 +34,7 @@ class SourceItem(FileItem):
33
34
  super().__init__("")
34
35
  self.source_name_or_path = value
35
36
  self.is_license_text = False
37
+ self.is_manifest_file = False
36
38
  self.license_reference = ""
37
39
  self.scanoss_reference = {}
38
40
  self.matched_lines = "" # Only for SCANOSS results
@@ -146,3 +148,13 @@ def is_manifest_file(file_path: str) -> bool:
146
148
  pattern = r"({})$".format("|".join(_manifest_filename))
147
149
  filename = os.path.basename(file_path)
148
150
  return bool(re.match(pattern, filename, re.IGNORECASE))
151
+
152
+
153
+ def is_package_dir(dir_path: str) -> bool:
154
+ path_parts = dir_path.split(os.path.sep)
155
+ for pkg_dir in _package_directory:
156
+ if pkg_dir in path_parts:
157
+ pkg_index = path_parts.index(pkg_dir)
158
+ pkg_path = os.path.sep.join(path_parts[:pkg_index + 1])
159
+ return True, pkg_path
160
+ return False, ""
@@ -127,6 +127,8 @@ def run_scan(
127
127
  result_list, key=lambda row: (''.join(row.licenses)))
128
128
 
129
129
  for scan_item in result_list:
130
+ if os.path.isdir(scan_item.source_name_or_path):
131
+ continue
130
132
  if check_binary(os.path.join(path_to_scan, scan_item.source_name_or_path)):
131
133
  scan_item.exclude = True
132
134
  except Exception as ex:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fosslight-source
3
- Version: 2.1.11
3
+ Version: 2.1.13
4
4
  Summary: FOSSLight Source Scanner
5
5
  Home-page: https://github.com/fosslight/fosslight_source_scanner
6
6
  Download-URL: https://github.com/fosslight/fosslight_source_scanner
@@ -6,4 +6,6 @@ PyYAML
6
6
  wheel>=0.38.1
7
7
  intbitset
8
8
  fosslight_binary>=5.0.0
9
- scancode-toolkit
9
+ scancode-toolkit>=32.0.2
10
+ fingerprints==1.2.3
11
+ normality==2.6.1