fosslight-util 2.1.36__py3-none-any.whl → 2.1.38__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.
fosslight_util/cover.py CHANGED
@@ -18,8 +18,8 @@ class CoverItem:
18
18
 
19
19
  PKG_NAMES = [
20
20
  "fosslight_scanner",
21
- "fosslight_source",
22
21
  "fosslight_dependency",
22
+ "fosslight_source",
23
23
  "fosslight_binary"
24
24
  ]
25
25
 
@@ -48,6 +48,24 @@ class CoverItem:
48
48
  def __del__(self):
49
49
  pass
50
50
 
51
+ def get_sort_order(self):
52
+ for idx, pkg_name in enumerate(self.PKG_NAMES[1:], start=0):
53
+ if pkg_name in self.tool_name:
54
+ return idx
55
+ return 999
56
+
57
+ def __lt__(self, other):
58
+ return self.get_sort_order() < other.get_sort_order()
59
+
60
+ def create_merged_comment(self, cover_items):
61
+ if not cover_items:
62
+ return ""
63
+ sorted_items = sorted(cover_items)
64
+ comments = []
65
+ for ci in sorted_items:
66
+ comments.append(f'[{ci.tool_name}] {ci.comment}')
67
+ return '\n'.join(comments)
68
+
51
69
  def get_print_json(self):
52
70
  json_item = {}
53
71
  json_item[self.tool_name_key] = self.tool_name
fosslight_util/exclude.py CHANGED
@@ -7,8 +7,14 @@ import os
7
7
  import fnmatch
8
8
  from typing import List
9
9
 
10
- EXCLUDE_DIRECTORY = ["test", "tests", "doc", "docs"]
10
+ EXCLUDE_DIRECTORY = ["test", "tests", "doc", "docs", "intermediates"]
11
11
  PACKAGE_DIRECTORY = ["node_modules", "venv", "Pods", "Carthage"]
12
+ EXCLUDE_FILENAME = ["changelog", "config.guess", "config.sub", "changes", "ltmain.sh",
13
+ "configure", "configure.ac", "depcomp", "compile", "missing", "makefile",
14
+ 'fosslight_bin', 'fosslight_bin.exe']
15
+ EXCLUDE_FILE_EXTENSION = ['qm', 'xlsx', 'pdf', 'pptx', 'jfif', 'docx', 'doc', 'whl',
16
+ 'xls', 'xlsm', 'ppt', 'mp4', 'pyc', 'plist', 'dat',
17
+ "m4", "in", "po", "class"]
12
18
 
13
19
 
14
20
  def excluding_files(patterns: List[str], path_to_scan: str) -> List[str]:
@@ -98,13 +104,12 @@ def is_exclude_dir(rel_path: str) -> tuple:
98
104
  return False, False
99
105
 
100
106
 
101
- def get_excluded_paths(path_to_scan: str, custom_excluded_paths: list = [], exclude_file_extension: list = []) -> tuple:
107
+ def get_excluded_paths(path_to_scan: str, custom_excluded_paths: list = [], custom_exclude_extension: list = []) -> tuple:
102
108
  path_to_exclude = []
103
109
  path_to_exclude_with_dot = []
104
110
  excluded_files = set() # Use set for O(1) operations
105
111
  abs_path_to_scan = os.path.abspath(path_to_scan)
106
112
  custom_excluded_normalized = [p.replace('\\', '/') for p in custom_excluded_paths]
107
- exclude_extensions_lower = [ext.lower().lstrip('.') for ext in exclude_file_extension]
108
113
  cnt_file_except_skipped = 0
109
114
 
110
115
  for root, dirs, files in os.walk(path_to_scan):
@@ -124,23 +129,30 @@ def get_excluded_paths(path_to_scan: str, custom_excluded_paths: list = [], excl
124
129
  file_path = os.path.join(root, file_name)
125
130
  rel_path = os.path.relpath(file_path, abs_path_to_scan).replace('\\', '/')
126
131
  should_exclude = False
127
- has_dot = False
132
+ except_info_sheet = False
128
133
  if not _has_parent_in_exclude_list(rel_path, path_to_exclude):
134
+ file_ext = os.path.splitext(file_name)[1].lstrip('.').lower()
129
135
  if rel_path in custom_excluded_normalized:
130
136
  should_exclude = True
131
137
  elif file_name in custom_excluded_normalized:
132
138
  should_exclude = True
133
139
  elif file_name.startswith('.'):
134
140
  should_exclude = True
135
- has_dot = True
136
- elif exclude_extensions_lower:
137
- file_ext = os.path.splitext(file_name)[1].lstrip('.').lower()
138
- if file_ext in exclude_extensions_lower:
139
- should_exclude = True
141
+ except_info_sheet = True
142
+ elif file_ext and file_ext in custom_exclude_extension:
143
+ should_exclude = True
144
+ elif file_name.lower() in EXCLUDE_FILENAME:
145
+ should_exclude = True
146
+ except_info_sheet = True
147
+ cnt_file_except_skipped += 1
148
+ elif file_ext and file_ext in EXCLUDE_FILE_EXTENSION:
149
+ should_exclude = True
150
+ except_info_sheet = True
151
+ cnt_file_except_skipped += 1
140
152
 
141
153
  if should_exclude:
142
154
  path_to_exclude.append(rel_path)
143
- if has_dot:
155
+ if except_info_sheet:
144
156
  path_to_exclude_with_dot.append(rel_path)
145
157
  excluded_files.add(rel_path)
146
158
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fosslight_util
3
- Version: 2.1.36
3
+ Version: 2.1.38
4
4
  Summary: FOSSLight Util
5
5
  Home-page: https://github.com/fosslight/fosslight_util
6
6
  Download-URL: https://github.com/fosslight/fosslight_util
@@ -3,9 +3,9 @@ fosslight_util/_get_downloadable_url.py,sha256=Komp1ODhqCKbnqGl7T-EDT8KmQuvgOeZ-
3
3
  fosslight_util/compare_yaml.py,sha256=eLqqCLgERxRHN5vsnpQVMXIEU862Lx66mD_y4uMgQE4,2916
4
4
  fosslight_util/constant.py,sha256=3BzJtyxC0o5IFAhYaUW-DeTKkA6f5tDJFJTb0k5ji9Y,2418
5
5
  fosslight_util/correct.py,sha256=1WEAL-9_KhjFPLucPhv0PNN3K7avm0z8mU6sTuSyeHM,3864
6
- fosslight_util/cover.py,sha256=qqqKzxqFwKimal764FaugRUBcHWdeKt8af6xeK0mH8E,2040
6
+ fosslight_util/cover.py,sha256=yrWwguN5VM7mOllljiDVykPfuLYfI11kcJ6gEs49Bjo,2616
7
7
  fosslight_util/download.py,sha256=AWwD3FWhF-bMagWINJ-Dg1VMuycXbe8VXX7qQ09YjYs,23565
8
- fosslight_util/exclude.py,sha256=oeBwkc4T80mXdt6_0ak3FGwwzvXpSO-P4Wfd1OT2i3Y,6070
8
+ fosslight_util/exclude.py,sha256=a8aEBglvc1Ub5cRtXHqpzbmuyhzgH3O-X1rFDHkOayc,6841
9
9
  fosslight_util/get_pom_license.py,sha256=vmh2LG1_4U7ts9SSpN3_UAANWbx5GBAVjremwm62OFY,5639
10
10
  fosslight_util/help.py,sha256=VomACZeXEMCiT1nxUwPqQAiVdNaMarwHVz9e10qbFc0,4954
11
11
  fosslight_util/oss_item.py,sha256=8890JHb5ZoKQWAwN7Fl8badnlYatJtF4MVJz1rdS4yQ,6938
@@ -25,9 +25,9 @@ fosslight_util/write_yaml.py,sha256=QlEKoIPQsEaYERfbP53TeKgnllYzhLQWm5wYjnWtVjE,
25
25
  fosslight_util/resources/frequentLicenselist.json,sha256=GUhzK6tu7ok10fekOnmVmUgIGRC-acGABZKTNKfDyYA,4776157
26
26
  fosslight_util/resources/frequent_license_nick_list.json,sha256=ryU2C_6ZxHbz90_sUN9OvI9GXkCMLu7oGcmd9W79YYo,5005
27
27
  fosslight_util/resources/licenses.json,sha256=mK55z-bhY7Mjpj2KsO1crKGGL-X3F6MBFQJ0zLlx010,240843
28
- fosslight_util-2.1.36.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
29
- fosslight_util-2.1.36.dist-info/METADATA,sha256=n-reuC9PkPU9QFJWRqn5UheXoG8y7ICNbolRgdcos6E,6365
30
- fosslight_util-2.1.36.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
31
- fosslight_util-2.1.36.dist-info/entry_points.txt,sha256=0yZggRWNwDaClDG8UmUA10UFG8cVX3Jiy5gG9nW7hJs,68
32
- fosslight_util-2.1.36.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
33
- fosslight_util-2.1.36.dist-info/RECORD,,
28
+ fosslight_util-2.1.38.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
29
+ fosslight_util-2.1.38.dist-info/METADATA,sha256=8v1p52zrqs998FTozt23F13UkBRPPQofsD7GlHzbPHQ,6365
30
+ fosslight_util-2.1.38.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
31
+ fosslight_util-2.1.38.dist-info/entry_points.txt,sha256=0yZggRWNwDaClDG8UmUA10UFG8cVX3Jiy5gG9nW7hJs,68
32
+ fosslight_util-2.1.38.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
33
+ fosslight_util-2.1.38.dist-info/RECORD,,