fosslight-scanner 2.1.12__tar.gz → 2.1.14__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 (31) hide show
  1. {fosslight_scanner-2.1.12/src/fosslight_scanner.egg-info → fosslight_scanner-2.1.14}/PKG-INFO +5 -5
  2. fosslight_scanner-2.1.14/requirements.txt +11 -0
  3. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/setup.py +1 -1
  4. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner/_help.py +3 -1
  5. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner/fosslight_scanner.py +59 -14
  6. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14/src/fosslight_scanner.egg-info}/PKG-INFO +5 -5
  7. fosslight_scanner-2.1.14/src/fosslight_scanner.egg-info/requires.txt +11 -0
  8. fosslight_scanner-2.1.12/requirements.txt +0 -11
  9. fosslight_scanner-2.1.12/src/fosslight_scanner.egg-info/requires.txt +0 -11
  10. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/LICENSE +0 -0
  11. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/MANIFEST.in +0 -0
  12. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/README.md +0 -0
  13. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/setup.cfg +0 -0
  14. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner/__init__.py +0 -0
  15. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner/_get_input.py +0 -0
  16. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner/_parse_setting.py +0 -0
  17. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner/_run_compare.py +0 -0
  18. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner/cli.py +0 -0
  19. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner/common.py +0 -0
  20. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner/resources/bom_compare.html +0 -0
  21. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner.egg-info/SOURCES.txt +0 -0
  22. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner.egg-info/dependency_links.txt +0 -0
  23. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner.egg-info/entry_points.txt +0 -0
  24. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/src/fosslight_scanner.egg-info/top_level.txt +0 -0
  25. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/tests/test__get_input.py +0 -0
  26. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/tests/test__help.py +0 -0
  27. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/tests/test__parse_setting.py +0 -0
  28. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/tests/test__run_compare.py +0 -0
  29. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/tests/test_cli.py +0 -0
  30. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/tests/test_common.py +0 -0
  31. {fosslight_scanner-2.1.12 → fosslight_scanner-2.1.14}/tests/test_fosslight_scanner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fosslight_scanner
3
- Version: 2.1.12
3
+ Version: 2.1.14
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,10 +20,10 @@ 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.35
24
- Requires-Dist: fosslight_source<3.0.0,>=2.2.1
25
- Requires-Dist: fosslight_dependency<5.0.0,>=4.1.28
26
- Requires-Dist: fosslight_binary<6.0.0,>=5.1.16
23
+ Requires-Dist: fosslight_util<3.0.0,>=2.1.37
24
+ Requires-Dist: fosslight_source<3.0.0,>=2.2.3
25
+ Requires-Dist: fosslight_dependency<5.0.0,>=4.1.30
26
+ Requires-Dist: fosslight_binary<6.0.0,>=5.1.17
27
27
  Requires-Dist: fosslight_prechecker<5.0.0,>=4.0.0
28
28
  Dynamic: author
29
29
  Dynamic: classifier
@@ -0,0 +1,11 @@
1
+ future
2
+ pandas
3
+ openpyxl
4
+ progress
5
+ pyyaml
6
+ beautifulsoup4
7
+ fosslight_util>=2.1.37,<3.0.0
8
+ fosslight_source>=2.2.3,<3.0.0
9
+ fosslight_dependency>=4.1.30,<5.0.0
10
+ fosslight_binary>=5.1.17,<6.0.0
11
+ fosslight_prechecker>=4.0.0,<5.0.0
@@ -15,7 +15,7 @@ with open('requirements.txt', 'r', 'utf-8') as f:
15
15
  if __name__ == "__main__":
16
16
  setup(
17
17
  name='fosslight_scanner',
18
- version='2.1.12',
18
+ version='2.1.14',
19
19
  package_dir={"": "src"},
20
20
  packages=find_packages(where='src'),
21
21
  description='FOSSLight Scanner',
@@ -29,7 +29,9 @@ _HELP_MESSAGE_SCANNER = f"""
29
29
  -f <formats> [<format> ...]\t FOSSLight Report file format ({', '.join(SUPPORT_FORMAT)})
30
30
  * Compare mode result file: supports excel, json, yaml, html
31
31
  * Multiple formats can be specified separated by space.
32
- -e <path>\t\t Path to exclude from analysis (ex, -e [dir] [file])
32
+ -e <path>\t\t Path to exclude from analysis (files and directories)
33
+ * IMPORTANT: Always wrap patterns in double quotes ("") to avoid shell expansion.
34
+ Example) fosslight -e "test/abc.py" "*.jar"
33
35
  -o <output>\t\t Output directory or file
34
36
  -c <number>\t\t Number of processes to analyze source
35
37
  -r\t\t\t Keep raw data
@@ -28,6 +28,7 @@ from fosslight_util.output_format import check_output_formats_v2
28
28
  from fosslight_util.cover import CoverItem
29
29
  from fosslight_util.oss_item import ScannerItem
30
30
  from fosslight_util.output_format import write_output_file
31
+ from fosslight_util.exclude import get_excluded_paths
31
32
 
32
33
  from .common import (
33
34
  call_analysis_api, update_oss_item,
@@ -46,7 +47,7 @@ COMPARE_OUTPUT_REPORT_PREFIX = "fosslight_compare_"
46
47
  PKG_NAME = "fosslight_scanner"
47
48
  logger = logging.getLogger(constant.LOGGER_NAME)
48
49
  warnings.simplefilter(action='ignore', category=FutureWarning)
49
- _output_dir = "fosslight_raw_data"
50
+ _output_dir = ".fosslight_raw_data"
50
51
  _log_file = "fosslight_log_all_"
51
52
  _start_time = ""
52
53
  _executed_path = ""
@@ -58,7 +59,7 @@ SCANNER_MODE = [
58
59
 
59
60
 
60
61
  def run_dependency(path_to_analyze, output_file_with_path, params="", path_to_exclude=[], formats=[],
61
- recursive_dep=False):
62
+ recursive_dep=False, all_exclude_mode=()):
62
63
  result = []
63
64
 
64
65
  package_manager = ""
@@ -103,7 +104,8 @@ def run_dependency(path_to_analyze, output_file_with_path, params="", path_to_ex
103
104
  output_custom_dir, app_name,
104
105
  github_token, formats, True, path_to_exclude=path_to_exclude,
105
106
  graph_path="", graph_size=(600,600),
106
- recursive=recursive_dep
107
+ recursive=recursive_dep,
108
+ all_exclude_mode=all_exclude_mode
107
109
  )
108
110
  if success:
109
111
  result = scan_item
@@ -181,6 +183,10 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
181
183
  if not correct_fpath:
182
184
  correct_fpath = src_path
183
185
 
186
+ excluded_path_with_default_exclusion, excluded_path_without_dot, excluded_files, cnt_file_except_skipped = (
187
+ get_excluded_paths(src_path, path_to_exclude))
188
+ logger.debug(f"Skipped paths: {excluded_path_with_default_exclusion}")
189
+
184
190
  try:
185
191
  final_excel_dir = os.path.abspath(final_excel_dir)
186
192
  abs_path = os.path.abspath(src_path)
@@ -203,7 +209,10 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
203
209
  source_write_json_file=source_write_json_file,
204
210
  source_print_matched_text=source_print_matched_text,
205
211
  source_time_out=source_time_out,
206
- formats=formats
212
+ formats=formats,
213
+ all_exclude_mode=(excluded_path_with_default_exclusion,
214
+ excluded_path_without_dot,
215
+ excluded_files, cnt_file_except_skipped)
207
216
  )
208
217
  if success:
209
218
  all_scan_item.file_items.update(result[2].file_items)
@@ -228,7 +237,11 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
228
237
  _output_dir,
229
238
  formats, db_url, binary_simple,
230
239
  correct_mode, correct_fpath,
231
- path_to_exclude=path_to_exclude)
240
+ path_to_exclude=path_to_exclude,
241
+ all_exclude_mode=(excluded_path_with_default_exclusion,
242
+ excluded_path_without_dot,
243
+ excluded_files,
244
+ cnt_file_except_skipped))
232
245
  if success:
233
246
  all_scan_item.file_items.update(result.file_items)
234
247
  all_cover_items.append(result.cover)
@@ -236,7 +249,10 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
236
249
  if run_dep:
237
250
  dep_scanitem = run_dependency(src_path, _output_dir,
238
251
  dep_arguments, path_to_exclude, formats,
239
- recursive_dep)
252
+ recursive_dep,
253
+ all_exclude_mode=(excluded_path_with_default_exclusion,
254
+ excluded_path_without_dot,
255
+ excluded_files, cnt_file_except_skipped))
240
256
  all_scan_item.file_items.update(dep_scanitem.file_items)
241
257
  all_cover_items.append(dep_scanitem.cover)
242
258
  else:
@@ -249,7 +265,7 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
249
265
  cover = CoverItem(tool_name=PKG_NAME,
250
266
  start_time=_start_time,
251
267
  input_path=abs_path,
252
- exclude_path=path_to_exclude,
268
+ exclude_path=excluded_path_without_dot,
253
269
  simple_mode=False)
254
270
  merge_comment = []
255
271
  for ci in all_cover_items:
@@ -335,6 +351,38 @@ def download_source(link, out_dir):
335
351
  return success, temp_src_dir, oss_name, oss_version
336
352
 
337
353
 
354
+ def rename_and_remove_hidden_folder(output_path, output_dir, keep_raw_data=False):
355
+ try:
356
+ hidden_log_dir = os.path.join(output_path, ".fosslight_log")
357
+ visible_log_dir = os.path.join(output_path, "fosslight_log")
358
+ if os.path.exists(hidden_log_dir):
359
+ try:
360
+ if os.path.exists(visible_log_dir):
361
+ shutil.rmtree(visible_log_dir)
362
+ shutil.move(hidden_log_dir, visible_log_dir)
363
+ except Exception as ex:
364
+ logger.debug(f"Error renaming log folder: {ex}")
365
+
366
+ if keep_raw_data:
367
+ visible_raw_dir = os.path.join(os.path.dirname(output_dir), "fosslight_raw_data")
368
+ if os.path.exists(output_dir):
369
+ if os.path.exists(visible_raw_dir):
370
+ shutil.rmtree(visible_raw_dir)
371
+ shutil.move(output_dir, visible_raw_dir)
372
+ logger.debug(f"Renamed {output_dir} to {visible_raw_dir}")
373
+ else:
374
+ logger.debug(f"Remove temporary files: {output_dir}")
375
+ if os.path.exists(output_dir):
376
+ shutil.rmtree(output_dir)
377
+
378
+ visible_raw_dir = os.path.join(os.path.dirname(output_dir), "fosslight_raw_data")
379
+ if os.path.exists(visible_raw_dir):
380
+ shutil.rmtree(visible_raw_dir)
381
+ logger.debug(f"Removed previous raw data folder: {visible_raw_dir}")
382
+ except Exception as ex:
383
+ logger.debug(f"Error cleaning up output directories: {ex}")
384
+
385
+
338
386
  def init(output_path="", make_outdir=True):
339
387
  global _output_dir, _log_file, _start_time, logger
340
388
 
@@ -352,7 +400,7 @@ def init(output_path="", make_outdir=True):
352
400
  Path(_output_dir).mkdir(parents=True, exist_ok=True)
353
401
  _output_dir = os.path.abspath(_output_dir)
354
402
 
355
- log_dir = os.path.join(output_root_dir, "fosslight_log")
403
+ log_dir = os.path.join(output_root_dir, ".fosslight_log")
356
404
  logger, result_log = init_log(os.path.join(log_dir, f"{_log_file}{_start_time}.txt"),
357
405
  True, logging.INFO, logging.DEBUG, PKG_NAME)
358
406
 
@@ -480,12 +528,9 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
480
528
  shutil.rmtree(extract_folder)
481
529
  else:
482
530
  logger.error("(mode) No mode has been selected for analysis.")
483
- try:
484
- if not keep_raw_data:
485
- logger.debug(f"Remove temporary files: {_output_dir}")
486
- shutil.rmtree(_output_dir)
487
- except Exception as ex:
488
- logger.debug(f"Error to remove temp files:{ex}")
531
+
532
+ rename_and_remove_hidden_folder(output_path, _output_dir, keep_raw_data)
533
+
489
534
  except Exception as ex:
490
535
  logger.warning(str(ex))
491
536
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fosslight_scanner
3
- Version: 2.1.12
3
+ Version: 2.1.14
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,10 +20,10 @@ 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.35
24
- Requires-Dist: fosslight_source<3.0.0,>=2.2.1
25
- Requires-Dist: fosslight_dependency<5.0.0,>=4.1.28
26
- Requires-Dist: fosslight_binary<6.0.0,>=5.1.16
23
+ Requires-Dist: fosslight_util<3.0.0,>=2.1.37
24
+ Requires-Dist: fosslight_source<3.0.0,>=2.2.3
25
+ Requires-Dist: fosslight_dependency<5.0.0,>=4.1.30
26
+ Requires-Dist: fosslight_binary<6.0.0,>=5.1.17
27
27
  Requires-Dist: fosslight_prechecker<5.0.0,>=4.0.0
28
28
  Dynamic: author
29
29
  Dynamic: classifier
@@ -0,0 +1,11 @@
1
+ future
2
+ pandas
3
+ openpyxl
4
+ progress
5
+ pyyaml
6
+ beautifulsoup4
7
+ fosslight_util<3.0.0,>=2.1.37
8
+ fosslight_source<3.0.0,>=2.2.3
9
+ fosslight_dependency<5.0.0,>=4.1.30
10
+ fosslight_binary<6.0.0,>=5.1.17
11
+ fosslight_prechecker<5.0.0,>=4.0.0
@@ -1,11 +0,0 @@
1
- future
2
- pandas
3
- openpyxl
4
- progress
5
- pyyaml
6
- beautifulsoup4
7
- fosslight_util>=2.1.35,<3.0.0
8
- fosslight_source>=2.2.1,<3.0.0
9
- fosslight_dependency>=4.1.28,<5.0.0
10
- fosslight_binary>=5.1.16,<6.0.0
11
- fosslight_prechecker>=4.0.0,<5.0.0
@@ -1,11 +0,0 @@
1
- future
2
- pandas
3
- openpyxl
4
- progress
5
- pyyaml
6
- beautifulsoup4
7
- fosslight_util<3.0.0,>=2.1.35
8
- fosslight_source<3.0.0,>=2.2.1
9
- fosslight_dependency<5.0.0,>=4.1.28
10
- fosslight_binary<6.0.0,>=5.1.16
11
- fosslight_prechecker<5.0.0,>=4.0.0