scanoss 1.20.0__py3-none-any.whl → 1.20.2__py3-none-any.whl

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 (67) hide show
  1. protoc_gen_swagger/__init__.py +13 -13
  2. protoc_gen_swagger/options/__init__.py +13 -13
  3. protoc_gen_swagger/options/annotations_pb2.py +12 -9
  4. protoc_gen_swagger/options/annotations_pb2_grpc.py +1 -1
  5. protoc_gen_swagger/options/openapiv2_pb2.py +98 -96
  6. protoc_gen_swagger/options/openapiv2_pb2_grpc.py +1 -1
  7. scanoss/__init__.py +18 -18
  8. scanoss/api/__init__.py +17 -17
  9. scanoss/api/common/__init__.py +17 -17
  10. scanoss/api/common/v2/__init__.py +17 -17
  11. scanoss/api/common/v2/scanoss_common_pb2.py +18 -18
  12. scanoss/api/common/v2/scanoss_common_pb2_grpc.py +1 -1
  13. scanoss/api/components/__init__.py +17 -17
  14. scanoss/api/components/v2/__init__.py +17 -17
  15. scanoss/api/components/v2/scanoss_components_pb2.py +48 -38
  16. scanoss/api/components/v2/scanoss_components_pb2_grpc.py +142 -96
  17. scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +22 -16
  18. scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +75 -49
  19. scanoss/api/dependencies/__init__.py +17 -17
  20. scanoss/api/dependencies/v2/__init__.py +17 -17
  21. scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +30 -24
  22. scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +75 -49
  23. scanoss/api/scanning/__init__.py +17 -17
  24. scanoss/api/scanning/v2/__init__.py +17 -17
  25. scanoss/api/scanning/v2/scanoss_scanning_pb2.py +10 -8
  26. scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +40 -32
  27. scanoss/api/semgrep/__init__.py +17 -17
  28. scanoss/api/semgrep/v2/__init__.py +17 -17
  29. scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +22 -18
  30. scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +71 -49
  31. scanoss/api/vulnerabilities/__init__.py +17 -17
  32. scanoss/api/vulnerabilities/v2/__init__.py +17 -17
  33. scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +37 -27
  34. scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +109 -72
  35. scanoss/cli.py +664 -356
  36. scanoss/components.py +67 -45
  37. scanoss/csvoutput.py +83 -56
  38. scanoss/cyclonedx.py +48 -46
  39. scanoss/data/build_date.txt +1 -1
  40. scanoss/file_filters.py +13 -15
  41. scanoss/filecount.py +43 -36
  42. scanoss/inspection/__init__.py +17 -17
  43. scanoss/inspection/copyleft.py +71 -58
  44. scanoss/inspection/policy_check.py +76 -53
  45. scanoss/inspection/undeclared_component.py +98 -75
  46. scanoss/inspection/utils/license_utils.py +66 -44
  47. scanoss/results.py +51 -60
  48. scanoss/scancodedeps.py +61 -38
  49. scanoss/scanner.py +203 -135
  50. scanoss/scanoss_settings.py +5 -3
  51. scanoss/scanossapi.py +98 -69
  52. scanoss/scanossbase.py +19 -19
  53. scanoss/scanossgrpc.py +73 -51
  54. scanoss/scanpostprocessor.py +9 -6
  55. scanoss/scantype.py +22 -21
  56. scanoss/spdxlite.py +265 -171
  57. scanoss/threadeddependencies.py +91 -61
  58. scanoss/threadedscanning.py +37 -31
  59. scanoss/utils/file.py +4 -4
  60. scanoss/winnowing.py +111 -47
  61. {scanoss-1.20.0.dist-info → scanoss-1.20.2.dist-info}/METADATA +1 -1
  62. scanoss-1.20.2.dist-info/RECORD +74 -0
  63. {scanoss-1.20.0.dist-info → scanoss-1.20.2.dist-info}/WHEEL +1 -1
  64. scanoss-1.20.0.dist-info/RECORD +0 -74
  65. {scanoss-1.20.0.dist-info → scanoss-1.20.2.dist-info}/LICENSE +0 -0
  66. {scanoss-1.20.0.dist-info → scanoss-1.20.2.dist-info}/entry_points.txt +0 -0
  67. {scanoss-1.20.0.dist-info → scanoss-1.20.2.dist-info}/top_level.txt +0 -0
scanoss/scancodedeps.py CHANGED
@@ -1,25 +1,25 @@
1
1
  """
2
- SPDX-License-Identifier: MIT
2
+ SPDX-License-Identifier: MIT
3
3
 
4
- Copyright (c) 2021, SCANOSS
4
+ Copyright (c) 2021, SCANOSS
5
5
 
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
12
 
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
15
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
23
23
  """
24
24
 
25
25
  import json
@@ -33,8 +33,17 @@ class ScancodeDeps(ScanossBase):
33
33
  """
34
34
  SCANOSS dependency scanning class
35
35
  """
36
- def __init__(self, debug: bool = False, quiet: bool = False, trace: bool = False, output_file: str = None,
37
- scan_output: str = None, timeout: int = 600, sc_command: str = None):
36
+
37
+ def __init__(
38
+ self,
39
+ debug: bool = False,
40
+ quiet: bool = False,
41
+ trace: bool = False,
42
+ output_file: str = None,
43
+ scan_output: str = None,
44
+ timeout: int = 600,
45
+ sc_command: str = None,
46
+ ):
38
47
  """
39
48
  Initialise ScancodeDeps class
40
49
  """
@@ -54,12 +63,11 @@ class ScancodeDeps(ScanossBase):
54
63
  if not outfile and self.scan_output:
55
64
  outfile = self.scan_output
56
65
  if outfile:
57
- with open(outfile, "a") as rf:
66
+ with open(outfile, 'a') as rf:
58
67
  rf.write(string + '\n')
59
68
  else:
60
69
  print(string)
61
70
 
62
-
63
71
  def remove_interim_file(self, output_file: str = None):
64
72
  """
65
73
  Remove the temporary Scancode interim file
@@ -86,7 +94,7 @@ class ScancodeDeps(ScanossBase):
86
94
  self.print_debug(f'Processing Scancode results into Dependency data...')
87
95
  files = []
88
96
  for t in data:
89
- if t == 'files': # Only interested in 'files' details
97
+ if t == 'files': # Only interested in 'files' details
90
98
  files_details = data.get(t)
91
99
  if not files_details or files_details == '':
92
100
  continue
@@ -121,7 +129,7 @@ class ScancodeDeps(ScanossBase):
121
129
  dp_data = {'purl': dp}
122
130
  rq = d.get('extracted_requirement') # scancode format 2.0
123
131
  if not rq or rq == '':
124
- rq = d.get('requirement') # scancode format 1.0
132
+ rq = d.get('requirement') # scancode format 1.0
125
133
  # skip requirement if it ends with the purl (i.e. exact version) or if it's local (file)
126
134
  if rq and rq != '' and not dp.endswith(rq) and not rq.startswith('file:'):
127
135
  dp_data['requirement'] = rq
@@ -206,17 +214,32 @@ class ScancodeDeps(ScanossBase):
206
214
  output_file = self.output_file
207
215
  try:
208
216
  open(output_file, 'w').close()
209
- self.print_trace(f'About to execute {self.sc_command} -p --only-findings --quiet --json {output_file}'
210
- f' {what_to_scan}')
211
- result = subprocess.run([self.sc_command, '-p', '--only-findings', '--quiet', '--strip-root', '--json',
212
- output_file, what_to_scan],
213
- cwd=os.getcwd(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
214
- text=True, timeout=self.timeout
215
- )
217
+ self.print_trace(
218
+ f'About to execute {self.sc_command} -p --only-findings --quiet --json {output_file} {what_to_scan}'
219
+ )
220
+ result = subprocess.run(
221
+ [
222
+ self.sc_command,
223
+ '-p',
224
+ '--only-findings',
225
+ '--quiet',
226
+ '--strip-root',
227
+ '--json',
228
+ output_file,
229
+ what_to_scan,
230
+ ],
231
+ cwd=os.getcwd(),
232
+ stdout=subprocess.PIPE,
233
+ stderr=subprocess.STDOUT,
234
+ text=True,
235
+ timeout=self.timeout,
236
+ )
216
237
  self.print_trace(f'Subprocess return: {result}')
217
238
  if result.returncode:
218
- self.print_stderr(f'ERROR: Scancode dependency scan of {what_to_scan} failed with exit code'
219
- f' {result.returncode}:\n{result.stdout}')
239
+ self.print_stderr(
240
+ f'ERROR: Scancode dependency scan of {what_to_scan} failed with exit code'
241
+ f' {result.returncode}:\n{result.stdout}'
242
+ )
220
243
  return False
221
244
  except subprocess.TimeoutExpired as e:
222
245
  self.print_stderr(f'ERROR: Timed out attempting to run scancode dependency scan on {what_to_scan}: {e}')
@@ -245,21 +268,21 @@ class ScancodeDeps(ScanossBase):
245
268
  self.print_stderr(f'ERROR: Problem loading input JSON: {e}')
246
269
  return None
247
270
 
248
-
249
271
  @staticmethod
250
- def __remove_dep_scope(deps: json)->json:
272
+ def __remove_dep_scope(deps: json) -> json:
251
273
  """
252
274
  :param deps: dependencies with scopes
253
275
  :return dependencies without scopes
254
276
  """
255
- files = deps.get("files")
277
+ files = deps.get('files')
256
278
  for file in files:
257
279
  if 'purls' in file:
258
- purls = file.get("purls")
280
+ purls = file.get('purls')
259
281
  for purl in purls:
260
- purl.pop("scope",None)
282
+ purl.pop('scope', None)
283
+
284
+ return {'files': files}
261
285
 
262
- return {"files": files }
263
286
 
264
287
  #
265
288
  # End of ScancodeDeps Class