fosslight-scanner 2.1.8__py3-none-any.whl → 2.1.10__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.
@@ -40,13 +40,14 @@ _HELP_MESSAGE_SCANNER = """
40
40
  --no_correction\t Enter if you don't want to correct OSS information with sbom-info.yaml
41
41
  * Correction mode only supported xlsx format.
42
42
  --correct_fpath <path> Path to the sbom-info.yaml file
43
- --ui\t\t\t Generate UI mode result file
43
+ --ui\t\t Generate UI mode result file
44
+ --recursive_dep\t Recursively analyze dependencies
44
45
 
45
46
  Options for only 'all' or 'bin' mode
46
47
  -u <db_url>\t\t DB Connection(format :'postgresql://username:password@host:port/database_name')
47
48
 
48
49
  Options for only 'all' or 'dependency' mode
49
- -d <dependency_argument>\t Additional arguments for running dependency analysis"""
50
+ -d <dependency_arg>\t Additional arguments for running dependency analysis"""
50
51
 
51
52
 
52
53
  def print_help_msg():
@@ -25,12 +25,13 @@ def parse_setting_json(data):
25
25
  source_print_matched_text = data.get('source_print_matched_text', False)
26
26
  source_time_out = data.get('source_time_out', 120)
27
27
  binary_simple = data.get('binary_simple', False)
28
+ recursive_dep = data.get('recursive_dep', False)
28
29
  str_lists = [mode, path, exclude_path]
29
30
  strings = [
30
31
  dep_argument, output, format, db_url,
31
32
  correct_fpath, link, selected_source_scanner
32
33
  ]
33
- booleans = [timer, raw, no_correction, ui, source_write_json_file, source_print_matched_text, binary_simple]
34
+ booleans = [timer, raw, no_correction, ui, source_write_json_file, source_print_matched_text, binary_simple, recursive_dep]
34
35
 
35
36
  is_incorrect = False
36
37
 
@@ -65,4 +66,4 @@ def parse_setting_json(data):
65
66
  return mode, path, dep_argument, output, format, link, db_url, timer, \
66
67
  raw, core, no_correction, correct_fpath, ui, exclude_path, \
67
68
  selected_source_scanner, source_write_json_file, source_print_matched_text, source_time_out, \
68
- binary_simple
69
+ binary_simple, recursive_dep
fosslight_scanner/cli.py CHANGED
@@ -15,7 +15,8 @@ from fosslight_util.help import print_package_version
15
15
 
16
16
 
17
17
  def set_args(mode, path, dep_argument, output, format, link, db_url, timer,
18
- raw, core, no_correction, correct_fpath, ui, setting, exclude_path):
18
+ raw, core, no_correction, correct_fpath, ui, setting, exclude_path,
19
+ recursive_dep):
19
20
 
20
21
  selected_source_scanner = "all"
21
22
  source_write_json_file = False
@@ -30,7 +31,7 @@ def set_args(mode, path, dep_argument, output, format, link, db_url, timer,
30
31
  s_mode, s_path, s_dep_argument, s_output, s_format, s_link, s_db_url, s_timer, s_raw, s_core, \
31
32
  s_no_correction, s_correct_fpath, s_ui, s_exclude_path, \
32
33
  s_selected_source_scanner, s_source_write_json_file, s_source_print_matched_text, \
33
- s_source_time_out, s_binary_simple = parse_setting_json(data)
34
+ s_source_time_out, s_binary_simple, s_recursive_dep = parse_setting_json(data)
34
35
 
35
36
  # direct cli arguments have higher priority than setting file
36
37
  mode = mode or s_mode
@@ -47,6 +48,7 @@ def set_args(mode, path, dep_argument, output, format, link, db_url, timer,
47
48
  correct_fpath = correct_fpath or s_correct_fpath
48
49
  ui = ui or s_ui
49
50
  exclude_path = exclude_path or s_exclude_path
51
+ recursive_dep = recursive_dep or s_recursive_dep
50
52
 
51
53
  # These options are only set from the setting file, not from CLI arguments
52
54
  selected_source_scanner = s_selected_source_scanner or selected_source_scanner
@@ -60,7 +62,7 @@ def set_args(mode, path, dep_argument, output, format, link, db_url, timer,
60
62
  return mode, path, dep_argument, output, format, link, db_url, timer, \
61
63
  raw, core, no_correction, correct_fpath, ui, exclude_path, \
62
64
  selected_source_scanner, source_write_json_file, source_print_matched_text, source_time_out, \
63
- binary_simple
65
+ binary_simple, recursive_dep
64
66
 
65
67
 
66
68
  def main():
@@ -79,7 +81,7 @@ def main():
79
81
  type=str, dest='format',nargs='*', default=[])
80
82
  parser.add_argument('--output', '-o', help='Output directory or file',
81
83
  type=str, dest='output', default="")
82
- parser.add_argument('--dependency', '-d', help='Dependency arguments',
84
+ parser.add_argument('--dependency', '-d', help='Dependency arguments (e.g. -d "-m pip" )',
83
85
  type=str, dest='dep_argument', default="")
84
86
  parser.add_argument('--url', '-u', help="DB Url",
85
87
  type=str, dest='db_url', default="")
@@ -105,6 +107,8 @@ def main():
105
107
  type=str, required=False, default='')
106
108
  parser.add_argument('--ui', help='Generate UI mode result file',
107
109
  action='store_true', required=False, default=False)
110
+ parser.add_argument('--recursive_dep', '-rd', help='Recursively analyze dependencies',
111
+ action='store_true', dest='recursive_dep', default=False)
108
112
 
109
113
  try:
110
114
  args = parser.parse_args()
@@ -118,16 +122,16 @@ def main():
118
122
  else:
119
123
  mode, path, dep_argument, output, format, link, db_url, timer, raw, core, no_correction, correct_fpath, \
120
124
  ui, exclude_path, selected_source_scanner, source_write_json_file, source_print_matched_text, \
121
- source_time_out, binary_simple, = set_args(
125
+ source_time_out, binary_simple, recursive_dep = set_args(
122
126
  args.mode, args.path, args.dep_argument, args.output,
123
127
  args.format, args.link, args.db_url, args.timer, args.raw,
124
128
  args.core, args.no_correction, args.correct_fpath, args.ui,
125
- args.setting, args.exclude_path)
129
+ args.setting, args.exclude_path, args.recursive_dep)
126
130
 
127
131
  run_main(mode, path, dep_argument, output, format, link, db_url, timer,
128
132
  raw, core, not no_correction, correct_fpath, ui, exclude_path,
129
133
  selected_source_scanner, source_write_json_file, source_print_matched_text,
130
- source_time_out, binary_simple)
134
+ source_time_out, binary_simple, recursive_dep)
131
135
 
132
136
 
133
137
  if __name__ == "__main__":
@@ -168,10 +168,12 @@ def correct_scanner_result(all_scan_item):
168
168
  try:
169
169
  remove_src_idx_list = []
170
170
  for idx_src, src_fileitem in enumerate(src_fileitems):
171
- src_fileitem.exclude = check_exclude_dir(src_fileitem.source_name_or_path, src_fileitem.exclude)
171
+ if check_package_dir(src_fileitem.source_name_or_path):
172
+ continue
172
173
  dup_flag = False
173
174
  for bin_fileitem in bin_fileitems:
174
- bin_fileitem.exclude = check_exclude_dir(bin_fileitem.source_name_or_path, bin_fileitem.exclude)
175
+ if check_package_dir(bin_fileitem.source_name_or_path):
176
+ continue
175
177
  if src_fileitem.source_name_or_path == bin_fileitem.source_name_or_path:
176
178
  dup_flag = True
177
179
  src_all_licenses_non_empty = all(oss_item.license for oss_item in src_fileitem.oss_items)
@@ -202,14 +204,12 @@ def correct_scanner_result(all_scan_item):
202
204
  return all_scan_item
203
205
 
204
206
 
205
- def check_exclude_dir(source_name_or_path, file_item_exclude):
206
- if file_item_exclude:
207
- return True
208
- _exclude_dirs = ["venv", "node_modules", "Pods", "Carthage"]
209
- exclude = False
207
+ def check_package_dir(source_name_or_path):
208
+ _package_dirs = ["venv", "node_modules", "Pods", "Carthage"]
209
+ is_pkg = False
210
210
 
211
- for exclude_dir in _exclude_dirs:
212
- if exclude_dir in source_name_or_path.split(os.path.sep):
213
- exclude = True
211
+ for package_dir in _package_dirs:
212
+ if package_dir in source_name_or_path.split(os.path.sep):
213
+ is_pkg = True
214
214
  break
215
- return exclude
215
+ return is_pkg
@@ -25,7 +25,6 @@ from fosslight_util.set_log import init_log
25
25
  from fosslight_util.timer_thread import TimerThread
26
26
  import fosslight_util.constant as constant
27
27
  from fosslight_util.output_format import check_output_formats_v2
28
- from fosslight_prechecker._precheck import run_lint as prechecker_lint
29
28
  from fosslight_util.cover import CoverItem
30
29
  from fosslight_util.oss_item import ScannerItem
31
30
  from fosslight_util.output_format import write_output_file
@@ -58,7 +57,8 @@ SCANNER_MODE = [
58
57
  ]
59
58
 
60
59
 
61
- def run_dependency(path_to_analyze, output_file_with_path, params="", path_to_exclude=[], formats=[]):
60
+ def run_dependency(path_to_analyze, output_file_with_path, params="", path_to_exclude=[], formats=[],
61
+ recursive_dep=False):
62
62
  result = []
63
63
 
64
64
  package_manager = ""
@@ -101,7 +101,9 @@ def run_dependency(path_to_analyze, output_file_with_path, params="", path_to_ex
101
101
  output_file_with_path,
102
102
  pip_activate_cmd, pip_deactivate_cmd,
103
103
  output_custom_dir, app_name,
104
- github_token, formats, True, path_to_exclude=path_to_exclude
104
+ github_token, formats, True, path_to_exclude=path_to_exclude,
105
+ graph_path="", graph_size=(600,600),
106
+ recursive=recursive_dep
105
107
  )
106
108
  if success:
107
109
  result = scan_item
@@ -132,7 +134,7 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
132
134
  default_oss_name="", default_oss_version="", url="",
133
135
  correct_mode=True, correct_fpath="", ui_mode=False, path_to_exclude=[],
134
136
  selected_source_scanner="all", source_write_json_file=False, source_print_matched_text=False,
135
- source_time_out=120, binary_simple=False, formats=[]):
137
+ source_time_out=120, binary_simple=False, formats=[], recursive_dep=False):
136
138
  final_excel_dir = output_path
137
139
  success = True
138
140
  all_cover_items = []
@@ -233,7 +235,8 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
233
235
 
234
236
  if run_dep:
235
237
  dep_scanitem = run_dependency(src_path, _output_dir,
236
- dep_arguments, path_to_exclude, formats)
238
+ dep_arguments, path_to_exclude, formats,
239
+ recursive_dep)
237
240
  all_scan_item.file_items.update(dep_scanitem.file_items)
238
241
  all_cover_items.append(dep_scanitem.cover)
239
242
  else:
@@ -360,7 +363,7 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
360
363
  db_url, hide_progressbar=False, keep_raw_data=False, num_cores=-1,
361
364
  correct_mode=True, correct_fpath="", ui_mode=False, path_to_exclude=[],
362
365
  selected_source_scanner="all", source_write_json_file=False, source_print_matched_text=False,
363
- source_time_out=120, binary_simple=False):
366
+ source_time_out=120, binary_simple=False, recursive_dep=False):
364
367
  global _executed_path, _start_time
365
368
 
366
369
  output_files = []
@@ -471,7 +474,7 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
471
474
  default_oss_name, default_oss_version, url_to_analyze,
472
475
  correct_mode, correct_fpath, ui_mode, path_to_exclude,
473
476
  selected_source_scanner, source_write_json_file, source_print_matched_text, source_time_out,
474
- binary_simple, formats)
477
+ binary_simple, formats, recursive_dep)
475
478
 
476
479
  if extract_folder:
477
480
  shutil.rmtree(extract_folder)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
2
- Name: fosslight-scanner
3
- Version: 2.1.8
1
+ Metadata-Version: 2.4
2
+ Name: fosslight_scanner
3
+ Version: 2.1.10
4
4
  Summary: FOSSLight Scanner
5
5
  Home-page: https://github.com/fosslight/fosslight_scanner
6
6
  Download-URL: https://github.com/fosslight/fosslight_scanner
@@ -20,11 +20,22 @@ Requires-Dist: openpyxl
20
20
  Requires-Dist: progress
21
21
  Requires-Dist: pyyaml
22
22
  Requires-Dist: beautifulsoup4
23
- Requires-Dist: fosslight-util<3.0.0,>=2.1.12
24
- Requires-Dist: fosslight-source<3.0.0,>=2.1.4
25
- Requires-Dist: fosslight-dependency<5.0.0,>=4.1.3
26
- Requires-Dist: fosslight-binary<6.0.0,>=5.1.2
27
- Requires-Dist: fosslight-prechecker<5.0.0,>=4.0.0
23
+ Requires-Dist: fosslight_util<3.0.0,>=2.1.12
24
+ Requires-Dist: fosslight_source<3.0.0,>=2.1.12
25
+ Requires-Dist: fosslight_dependency<5.0.0,>=4.1.3
26
+ Requires-Dist: fosslight_binary<6.0.0,>=5.1.9
27
+ Requires-Dist: fosslight_prechecker<5.0.0,>=4.0.0
28
+ Dynamic: author
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: download-url
33
+ Dynamic: home-page
34
+ Dynamic: license
35
+ Dynamic: license-file
36
+ Dynamic: requires-dist
37
+ Dynamic: requires-python
38
+ Dynamic: summary
28
39
 
29
40
  <!--
30
41
  Copyright (c) 2021 LG Electronics
@@ -0,0 +1,15 @@
1
+ fosslight_scanner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ fosslight_scanner/_get_input.py,sha256=f78M57QU7Lhw1VfZJKvYXbGsUiYMViPz1---UDIbV9I,1396
3
+ fosslight_scanner/_help.py,sha256=dq_fJoTzujChKV_RlgGlg080ZodwDZcXloYv-mwV-W0,3145
4
+ fosslight_scanner/_parse_setting.py,sha256=htxNNvhizZ2ZT18Aw6ihKuBpOMAyptkbMS5Z0_Xh5mQ,2551
5
+ fosslight_scanner/_run_compare.py,sha256=zmzX-FIvWCSkwPvEA3iHfVpyg6QDGUCpw3tJuGLdPWM,10657
6
+ fosslight_scanner/cli.py,sha256=vz_oGevbejqo3tHa4z6d-Ft0xu-gP9Pg-VmXb9IhO_s,6910
7
+ fosslight_scanner/common.py,sha256=FyEoqVsIZ4pRIlHRXZES8PYaYfy3PEmUaOn02YSuuYU,8377
8
+ fosslight_scanner/fosslight_scanner.py,sha256=wOSSnJZuUCvom9rvdwOUy7B2f-CUzDdecI2hm52dyFg,21174
9
+ fosslight_scanner/resources/bom_compare.html,sha256=VocJ9bDmQQOwfGyvXatPZ4W-QddO-IlsAvKdO0nZ7pA,2240
10
+ fosslight_scanner-2.1.10.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
+ fosslight_scanner-2.1.10.dist-info/METADATA,sha256=1YXdus_RPXOrScGAT1b6e9rOYzxdaP2gq9dZzX0_HuQ,8059
12
+ fosslight_scanner-2.1.10.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
13
+ fosslight_scanner-2.1.10.dist-info/entry_points.txt,sha256=dl7AA0_Jqnq0NHuCEaxcJFgstLw3sod_-FGtcgZuJbs,104
14
+ fosslight_scanner-2.1.10.dist-info/top_level.txt,sha256=43_xLb5KYpy8wOU1H2Wd2fEsWBY7Dg6ZEJJXkfT64Ak,18
15
+ fosslight_scanner-2.1.10.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,15 +0,0 @@
1
- fosslight_scanner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- fosslight_scanner/_get_input.py,sha256=f78M57QU7Lhw1VfZJKvYXbGsUiYMViPz1---UDIbV9I,1396
3
- fosslight_scanner/_help.py,sha256=-Dqgn1inH26614GjrIe8I5cdEziuAxTtwrUdtTkrpjQ,3084
4
- fosslight_scanner/_parse_setting.py,sha256=SoIEoPGlFXAp6__eEFEMIPYPoKLvmqxXF5X_C_uFiVI,2468
5
- fosslight_scanner/_run_compare.py,sha256=zmzX-FIvWCSkwPvEA3iHfVpyg6QDGUCpw3tJuGLdPWM,10657
6
- fosslight_scanner/cli.py,sha256=C4YNPVJJ-Ezj_6xe8k9QbIrf5V44GXbHWCGzR2FMcV8,6547
7
- fosslight_scanner/common.py,sha256=0LgXlGOJVB0kDeZ-1VeHEErArh7TgXkwEAmYAL9q93I,8465
8
- fosslight_scanner/fosslight_scanner.py,sha256=MIjKJ_HHyKKlh3HhuTtuezxTmX9guDWYDgjdXZP3IPU,21001
9
- fosslight_scanner/resources/bom_compare.html,sha256=VocJ9bDmQQOwfGyvXatPZ4W-QddO-IlsAvKdO0nZ7pA,2240
10
- fosslight_scanner-2.1.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
- fosslight_scanner-2.1.8.dist-info/METADATA,sha256=Ee5RYpuVUGR4ra07tmUcq8_6U14jF0AL1FuJWJFwJJ0,7821
12
- fosslight_scanner-2.1.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
13
- fosslight_scanner-2.1.8.dist-info/entry_points.txt,sha256=dl7AA0_Jqnq0NHuCEaxcJFgstLw3sod_-FGtcgZuJbs,104
14
- fosslight_scanner-2.1.8.dist-info/top_level.txt,sha256=43_xLb5KYpy8wOU1H2Wd2fEsWBY7Dg6ZEJJXkfT64Ak,18
15
- fosslight_scanner-2.1.8.dist-info/RECORD,,