scanoss 1.42.0__tar.gz → 1.43.0__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 (125) hide show
  1. {scanoss-1.42.0/src/scanoss.egg-info → scanoss-1.43.0}/PKG-INFO +1 -1
  2. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/__init__.py +1 -1
  3. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/cli.py +0 -5
  4. scanoss-1.43.0/src/scanoss/data/build_date.txt +1 -0
  5. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanner.py +9 -137
  6. {scanoss-1.42.0 → scanoss-1.43.0/src/scanoss.egg-info}/PKG-INFO +1 -1
  7. scanoss-1.42.0/src/scanoss/data/build_date.txt +0 -1
  8. {scanoss-1.42.0 → scanoss-1.43.0}/LICENSE +0 -0
  9. {scanoss-1.42.0 → scanoss-1.43.0}/PACKAGE.md +0 -0
  10. {scanoss-1.42.0 → scanoss-1.43.0}/README.md +0 -0
  11. {scanoss-1.42.0 → scanoss-1.43.0}/pyproject.toml +0 -0
  12. {scanoss-1.42.0 → scanoss-1.43.0}/setup.cfg +0 -0
  13. {scanoss-1.42.0 → scanoss-1.43.0}/src/protoc_gen_swagger/__init__.py +0 -0
  14. {scanoss-1.42.0 → scanoss-1.43.0}/src/protoc_gen_swagger/options/__init__.py +0 -0
  15. {scanoss-1.42.0 → scanoss-1.43.0}/src/protoc_gen_swagger/options/annotations_pb2.py +0 -0
  16. {scanoss-1.42.0 → scanoss-1.43.0}/src/protoc_gen_swagger/options/annotations_pb2.pyi +0 -0
  17. {scanoss-1.42.0 → scanoss-1.43.0}/src/protoc_gen_swagger/options/annotations_pb2_grpc.py +0 -0
  18. {scanoss-1.42.0 → scanoss-1.43.0}/src/protoc_gen_swagger/options/openapiv2_pb2.py +0 -0
  19. {scanoss-1.42.0 → scanoss-1.43.0}/src/protoc_gen_swagger/options/openapiv2_pb2.pyi +0 -0
  20. {scanoss-1.42.0 → scanoss-1.43.0}/src/protoc_gen_swagger/options/openapiv2_pb2_grpc.py +0 -0
  21. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/__init__.py +0 -0
  22. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/common/__init__.py +0 -0
  23. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/common/v2/__init__.py +0 -0
  24. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/common/v2/scanoss_common_pb2.py +0 -0
  25. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/common/v2/scanoss_common_pb2_grpc.py +0 -0
  26. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/components/__init__.py +0 -0
  27. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/components/v2/__init__.py +0 -0
  28. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/components/v2/scanoss_components_pb2.py +0 -0
  29. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py +0 -0
  30. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +0 -0
  31. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +0 -0
  32. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/dependencies/__init__.py +0 -0
  33. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/dependencies/v2/__init__.py +0 -0
  34. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +0 -0
  35. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +0 -0
  36. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/geoprovenance/__init__.py +0 -0
  37. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/geoprovenance/v2/__init__.py +0 -0
  38. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2.py +0 -0
  39. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2_grpc.py +0 -0
  40. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/licenses/__init__.py +0 -0
  41. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/licenses/v2/__init__.py +0 -0
  42. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/licenses/v2/scanoss_licenses_pb2.py +0 -0
  43. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/licenses/v2/scanoss_licenses_pb2_grpc.py +0 -0
  44. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/scanning/__init__.py +0 -0
  45. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/scanning/v2/__init__.py +0 -0
  46. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2.py +0 -0
  47. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +0 -0
  48. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/semgrep/__init__.py +0 -0
  49. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/semgrep/v2/__init__.py +0 -0
  50. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +0 -0
  51. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +0 -0
  52. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/vulnerabilities/__init__.py +0 -0
  53. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/vulnerabilities/v2/__init__.py +0 -0
  54. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +0 -0
  55. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +0 -0
  56. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/components.py +0 -0
  57. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/constants.py +0 -0
  58. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/cryptography.py +0 -0
  59. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/csvoutput.py +0 -0
  60. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/cyclonedx.py +0 -0
  61. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/data/osadl-copyleft.json +0 -0
  62. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/data/scanoss-settings-schema.json +0 -0
  63. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/data/spdx-exceptions.json +0 -0
  64. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/data/spdx-licenses.json +0 -0
  65. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/delta.py +0 -0
  66. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/export/__init__.py +0 -0
  67. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/export/dependency_track.py +0 -0
  68. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/file_filters.py +0 -0
  69. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/filecount.py +0 -0
  70. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/gitlabqualityreport.py +0 -0
  71. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/header_filter.py +0 -0
  72. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/__init__.py +0 -0
  73. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/policy_check/__init__.py +0 -0
  74. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/policy_check/dependency_track/__init__.py +0 -0
  75. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/policy_check/dependency_track/project_violation.py +0 -0
  76. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/policy_check/policy_check.py +0 -0
  77. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/policy_check/scanoss/__init__.py +0 -0
  78. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/policy_check/scanoss/copyleft.py +0 -0
  79. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/policy_check/scanoss/undeclared_component.py +0 -0
  80. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/summary/__init__.py +0 -0
  81. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/summary/component_summary.py +0 -0
  82. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/summary/license_summary.py +0 -0
  83. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/summary/match_summary.py +0 -0
  84. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/utils/file_utils.py +0 -0
  85. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/utils/license_utils.py +0 -0
  86. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/utils/markdown_utils.py +0 -0
  87. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/inspection/utils/scan_result_processor.py +0 -0
  88. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/osadl.py +0 -0
  89. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/results.py +0 -0
  90. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scancodedeps.py +0 -0
  91. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanners/__init__.py +0 -0
  92. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanners/container_scanner.py +0 -0
  93. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanners/folder_hasher.py +0 -0
  94. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanners/scanner_config.py +0 -0
  95. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanners/scanner_hfh.py +0 -0
  96. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanoss_settings.py +0 -0
  97. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanossapi.py +0 -0
  98. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanossbase.py +0 -0
  99. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanossgrpc.py +0 -0
  100. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scanpostprocessor.py +0 -0
  101. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/scantype.py +0 -0
  102. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/services/dependency_track_service.py +0 -0
  103. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/spdxlite.py +0 -0
  104. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/threadeddependencies.py +0 -0
  105. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/threadedscanning.py +0 -0
  106. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/utils/__init__.py +0 -0
  107. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/utils/abstract_presenter.py +0 -0
  108. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/utils/crc64.py +0 -0
  109. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/utils/file.py +0 -0
  110. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/utils/scanoss_scan_results_utils.py +0 -0
  111. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/utils/simhash.py +0 -0
  112. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss/winnowing.py +0 -0
  113. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss.egg-info/SOURCES.txt +0 -0
  114. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss.egg-info/dependency_links.txt +0 -0
  115. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss.egg-info/entry_points.txt +0 -0
  116. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss.egg-info/requires.txt +0 -0
  117. {scanoss-1.42.0 → scanoss-1.43.0}/src/scanoss.egg-info/top_level.txt +0 -0
  118. {scanoss-1.42.0 → scanoss-1.43.0}/tests/test_csv_output.py +0 -0
  119. {scanoss-1.42.0 → scanoss-1.43.0}/tests/test_file_filters.py +0 -0
  120. {scanoss-1.42.0 → scanoss-1.43.0}/tests/test_headers_filter.py +0 -0
  121. {scanoss-1.42.0 → scanoss-1.43.0}/tests/test_osadl.py +0 -0
  122. {scanoss-1.42.0 → scanoss-1.43.0}/tests/test_policy_inspect.py +0 -0
  123. {scanoss-1.42.0 → scanoss-1.43.0}/tests/test_scan_post_processor.py +0 -0
  124. {scanoss-1.42.0 → scanoss-1.43.0}/tests/test_spdxlite.py +0 -0
  125. {scanoss-1.42.0 → scanoss-1.43.0}/tests/test_winnowing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scanoss
3
- Version: 1.42.0
3
+ Version: 1.43.0
4
4
  Summary: Simple Python library to leverage the SCANOSS APIs
5
5
  Home-page: https://scanoss.com
6
6
  Author: SCANOSS
@@ -22,4 +22,4 @@ SPDX-License-Identifier: MIT
22
22
  THE SOFTWARE.
23
23
  """
24
24
 
25
- __version__ = '1.42.0'
25
+ __version__ = '1.43.0'
@@ -170,7 +170,6 @@ def setup_args() -> None: # noqa: PLR0912, PLR0915
170
170
  default=DEFAULT_RETRY,
171
171
  help='Retry limit for API communication (optional - default 5)',
172
172
  )
173
- p_scan.add_argument('--no-wfp-output', action='store_true', help='Skip WFP file generation')
174
173
  p_scan.add_argument('--dependencies', '-D', action='store_true', help='Add Dependency scanning')
175
174
  p_scan.add_argument('--dependencies-only', action='store_true', help='Run Dependency scanning only')
176
175
  p_scan.add_argument(
@@ -1552,9 +1551,6 @@ def scan(parser, args): # noqa: PLR0912, PLR0915
1552
1551
  if args.retry < 0:
1553
1552
  print_stderr(f'POST retry (--retry) too small: {args.retry}. Reverting to default.')
1554
1553
 
1555
- if not os.access(os.getcwd(), os.W_OK): # Make sure the current directory is writable. If not disable saving WFP
1556
- print_stderr(f'Warning: Current directory is not writable: {os.getcwd()}')
1557
- args.no_wfp_output = True
1558
1554
  if args.ca_cert and not os.path.exists(args.ca_cert):
1559
1555
  print_stderr(f'Error: Certificate file does not exist: {args.ca_cert}.')
1560
1556
  sys.exit(1)
@@ -1573,7 +1569,6 @@ def scan(parser, args): # noqa: PLR0912, PLR0915
1573
1569
  nb_threads=args.threads,
1574
1570
  post_size=args.post_size,
1575
1571
  timeout=args.timeout,
1576
- no_wfp_file=args.no_wfp_output,
1577
1572
  all_extensions=args.all_extensions,
1578
1573
  all_folders=args.all_folders,
1579
1574
  hidden_files_folders=args.all_hidden,
@@ -0,0 +1 @@
1
+ date: 20260105093002, utime: 1767605402
@@ -31,7 +31,6 @@ from pathlib import Path
31
31
  from typing import Any, Dict, List, Optional
32
32
 
33
33
  import importlib_resources
34
- from progress.bar import Bar
35
34
  from progress.spinner import Spinner
36
35
  from pypac.parser import PACFile
37
36
 
@@ -72,7 +71,6 @@ class Scanner(ScanossBase):
72
71
 
73
72
  def __init__( # noqa: PLR0913, PLR0915
74
73
  self,
75
- wfp: str = None,
76
74
  scan_output: str = None,
77
75
  output_format: str = 'plain',
78
76
  debug: bool = False,
@@ -84,7 +82,6 @@ class Scanner(ScanossBase):
84
82
  nb_threads: int = 5,
85
83
  post_size: int = 32,
86
84
  timeout: int = 180,
87
- no_wfp_file: bool = False,
88
85
  all_extensions: bool = False,
89
86
  all_folders: bool = False,
90
87
  hidden_files_folders: bool = False,
@@ -120,10 +117,8 @@ class Scanner(ScanossBase):
120
117
  skip_folders = []
121
118
  if skip_extensions is None:
122
119
  skip_extensions = []
123
- self.wfp = wfp if wfp else 'scanner_output.wfp'
124
120
  self.scan_output = scan_output
125
121
  self.output_format = output_format
126
- self.no_wfp_file = no_wfp_file
127
122
  self.isatty = sys.stderr.isatty()
128
123
  self.all_extensions = all_extensions
129
124
  self.all_folders = all_folders
@@ -372,8 +367,6 @@ class Scanner(ScanossBase):
372
367
  spinner_ctx = Spinner('Fingerprinting ') if (not self.quiet and self.isatty) else nullcontext()
373
368
 
374
369
  with spinner_ctx as spinner:
375
- save_wfps_for_print = not self.no_wfp_file or not self.threaded_scan
376
- wfp_list = []
377
370
  scan_block = ''
378
371
  scan_size = 0
379
372
  queue_size = 0
@@ -394,8 +387,6 @@ class Scanner(ScanossBase):
394
387
  if wfp is None or wfp == '':
395
388
  self.print_debug(f'No WFP returned for {to_scan_file}. Skipping.')
396
389
  continue
397
- if save_wfps_for_print:
398
- wfp_list.append(wfp)
399
390
  file_count += 1
400
391
  if self.threaded_scan:
401
392
  wfp_size = len(wfp.encode('utf-8'))
@@ -429,12 +420,6 @@ class Scanner(ScanossBase):
429
420
  self.threaded_scan.queue_add(scan_block) # Make sure all files have been submitted
430
421
 
431
422
  if file_count > 0:
432
- if save_wfps_for_print: # Write a WFP file if no threading is requested
433
- self.print_debug(f'Writing fingerprints to {self.wfp}')
434
- with open(self.wfp, 'w') as f:
435
- f.write(''.join(wfp_list))
436
- else:
437
- self.print_debug(f'Skipping writing WFP file {self.wfp}')
438
423
  if self.threaded_scan:
439
424
  success = self.__run_scan_threaded(scan_started, file_count)
440
425
  else:
@@ -642,8 +627,6 @@ class Scanner(ScanossBase):
642
627
  spinner_ctx = Spinner('Fingerprinting ') if (not self.quiet and self.isatty) else nullcontext()
643
628
 
644
629
  with spinner_ctx as spinner:
645
- save_wfps_for_print = not self.no_wfp_file or not self.threaded_scan
646
- wfp_list = []
647
630
  scan_block = ''
648
631
  scan_size = 0
649
632
  queue_size = 0
@@ -663,8 +646,6 @@ class Scanner(ScanossBase):
663
646
  if wfp is None or wfp == '':
664
647
  self.print_debug(f'No WFP returned for {file}. Skipping.')
665
648
  continue
666
- if save_wfps_for_print:
667
- wfp_list.append(wfp)
668
649
  file_count += 1
669
650
  if self.threaded_scan:
670
651
  wfp_size = len(wfp.encode('utf-8'))
@@ -699,12 +680,6 @@ class Scanner(ScanossBase):
699
680
  self.threaded_scan.queue_add(scan_block) # Make sure all files have been submitted
700
681
 
701
682
  if file_count > 0:
702
- if save_wfps_for_print: # Write a WFP file if no threading is requested
703
- self.print_debug(f'Writing fingerprints to {self.wfp}')
704
- with open(self.wfp, 'w') as f:
705
- f.write(''.join(wfp_list))
706
- else:
707
- self.print_debug(f'Skipping writing WFP file {self.wfp}')
708
683
  if self.threaded_scan:
709
684
  success = self.__run_scan_threaded(scan_started, file_count)
710
685
  else:
@@ -767,126 +742,22 @@ class Scanner(ScanossBase):
767
742
  success = False
768
743
  return success
769
744
 
770
- def scan_wfp_file(self, file: str = None) -> bool: # noqa: PLR0912, PLR0915
771
- """
772
- Scan the contents of the specified WFP file (in the current process)
773
- :param file: Scan the contents of the specified WFP file (in the current process)
774
- :return: True if successful, False otherwise
775
- """
776
- success = True
777
- wfp_file = file if file else self.wfp # If a WFP file is specified, use it, otherwise us the default
778
- if not os.path.exists(wfp_file) or not os.path.isfile(wfp_file):
779
- raise Exception(f'ERROR: Specified WFP file does not exist or is not a file: {wfp_file}')
780
- file_count = Scanner.__count_files_in_wfp_file(wfp_file)
781
- cur_files = 0
782
- cur_size = 0
783
- batch_files = 0
784
- wfp = ''
785
- max_component = {'name': '', 'hits': 0}
786
- components = {}
787
- self.print_debug(f'Found {file_count} files to process.')
788
- raw_output = '{\n'
789
- file_print = ''
790
- bar_ctx = Bar('Scanning', max=file_count) if (not self.quiet and self.isatty) else nullcontext()
791
-
792
- with bar_ctx as bar:
793
- if bar:
794
- bar.next(0)
795
- with open(wfp_file) as f:
796
- for line in f:
797
- if line.startswith(WFP_FILE_START):
798
- if file_print:
799
- wfp += file_print # Store the WFP for the current file
800
- cur_size = len(wfp.encode('utf-8'))
801
- file_print = line # Start storing the next file
802
- cur_files += 1
803
- batch_files += 1
804
- else:
805
- file_print += line # Store the rest of the WFP for this file
806
- l_size = cur_size + len(file_print.encode('utf-8'))
807
- # Hit the max post size, so sending the current batch and continue processing
808
- if l_size >= self.max_post_size and wfp:
809
- self.print_debug(
810
- f'Sending {batch_files} ({cur_files}) of'
811
- f' {file_count} ({len(wfp.encode("utf-8"))} bytes) files to the ScanOSS API.'
812
- )
813
- if self.debug and cur_size > self.max_post_size:
814
- Scanner.print_stderr(
815
- f'Warning: Post size {cur_size} greater than limit {self.max_post_size}'
816
- )
817
- scan_resp = self.scanoss_api.scan(wfp, max_component['name']) # Scan current WFP and store
818
- if bar:
819
- bar.next(batch_files)
820
- if scan_resp is not None:
821
- for key, value in scan_resp.items():
822
- raw_output += ' "%s":%s,' % (key, json.dumps(value, indent=2))
823
- for v in value:
824
- if hasattr(v, 'get'):
825
- if v.get('id') != 'none':
826
- vcv = '%s:%s:%s' % (v.get('vendor'), v.get('component'), v.get('version'))
827
- components[vcv] = components[vcv] + 1 if vcv in components else 1
828
- if max_component['hits'] < components[vcv]:
829
- max_component['name'] = v.get('component')
830
- max_component['hits'] = components[vcv]
831
- else:
832
- Scanner.print_stderr(f'Warning: Unknown value: {v}')
833
- else:
834
- success = False
835
- batch_files = 0
836
- wfp = ''
837
- if file_print:
838
- wfp += file_print # Store the WFP for the current file
839
- if wfp:
840
- self.print_debug(
841
- f'Sending {batch_files} ({cur_files}) of'
842
- f' {file_count} ({len(wfp.encode("utf-8"))} bytes) files to the ScanOSS API.'
843
- )
844
- scan_resp = self.scanoss_api.scan(wfp, max_component['name']) # Scan current WFP and store
845
- if bar:
846
- bar.next(batch_files)
847
- first = True
848
- if scan_resp is not None:
849
- for key, value in scan_resp.items():
850
- if first:
851
- raw_output += ' "%s":%s' % (key, json.dumps(value, indent=2))
852
- first = False
853
- else:
854
- raw_output += ',\n "%s":%s' % (key, json.dumps(value, indent=2))
855
- else:
856
- success = False
857
- raw_output += '\n}'
858
- if self.output_format == 'plain':
859
- self.__log_result(raw_output)
860
- elif self.output_format == 'cyclonedx':
861
- cdx = CycloneDx(self.debug, self.scan_output)
862
- cdx.produce_from_str(raw_output)
863
- elif self.output_format == 'spdxlite':
864
- spdxlite = SpdxLite(self.debug, self.scan_output)
865
- success = spdxlite.produce_from_str(raw_output)
866
- elif self.output_format == 'csv':
867
- csvo = CsvOutput(self.debug, self.scan_output)
868
- csvo.produce_from_str(raw_output)
869
- else:
870
- self.print_stderr(f'ERROR: Unknown output format: {self.output_format}')
871
- success = False
872
-
873
- return success
874
-
875
- def scan_wfp_with_options(self, wfp: str, deps_file: str, file_map: dict = None) -> bool:
745
+ def scan_wfp_with_options(self, wfp_file: str, deps_file: str, file_map: dict = None) -> bool:
876
746
  """
877
747
  Scan the given WFP file for whatever scaning options that have been configured
878
- :param wfp: WFP file to scan
748
+ :param wfp_file: WFP file to scan
879
749
  :param deps_file: pre-parsed dependency file to decorate
880
750
  :param file_map: mapping of obfuscated files back into originals
881
751
  :return: True if successful, False otherwise
882
752
  """
883
753
  success = True
884
- wfp_file = wfp if wfp else self.wfp # If a WFP file is specified, use it, otherwise us the default
754
+ if not wfp_file:
755
+ raise Exception('ERROR: Please specify a WFP file to scan')
885
756
  if not os.path.exists(wfp_file) or not os.path.isfile(wfp_file):
886
757
  raise Exception(f'ERROR: Specified WFP file does not exist or is not a file: {wfp_file}')
887
758
 
888
759
  if not self.is_file_or_snippet_scan() and not self.is_dependency_scan():
889
- raise Exception(f'ERROR: No scan options defined to scan WFP: {wfp}')
760
+ raise Exception(f'ERROR: No scan options defined to scan WFP: {wfp_file}')
890
761
 
891
762
  if self.scan_output:
892
763
  self.print_msg(f'Writing results to {self.scan_output}...')
@@ -901,14 +772,15 @@ class Scanner(ScanossBase):
901
772
  success = False
902
773
  return success
903
774
 
904
- def scan_wfp_file_threaded(self, file: str = None) -> bool:
775
+ def scan_wfp_file_threaded(self, wfp_file: str) -> bool: # noqa: PLR0912
905
776
  """
906
777
  Scan the contents of the specified WFP file (threaded)
907
- :param file: WFP file to scan (optional)
778
+ :param wfp_file: WFP file to scan
908
779
  return: True if successful, False otherwise
909
780
  """
910
781
  success = True
911
- wfp_file = file if file else self.wfp # If a WFP file is specified, use it, otherwise us the default
782
+ if not wfp_file:
783
+ raise Exception('ERROR: Please specify a WFP file to scan')
912
784
  if not os.path.exists(wfp_file) or not os.path.isfile(wfp_file):
913
785
  raise Exception(f'ERROR: Specified WFP file does not exist or is not a file: {wfp_file}')
914
786
  cur_size = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scanoss
3
- Version: 1.42.0
3
+ Version: 1.43.0
4
4
  Summary: Simple Python library to leverage the SCANOSS APIs
5
5
  Home-page: https://scanoss.com
6
6
  Author: SCANOSS
@@ -1 +0,0 @@
1
- date: 20251218123159, utime: 1766061119
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes