fosslight-util 2.1.7__py3-none-any.whl → 2.1.9__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.
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright (c) 2025 LG Electronics Inc.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ import os
7
+ import fnmatch
8
+
9
+ def excluding_files(patterns: list[str], path_to_scan: str) -> list[str]:
10
+ excluded_paths = set()
11
+
12
+ # Normalize patterns: e.g., 'sample/', 'sample/*' -> 'sample'
13
+ # Replace backslash with slash
14
+ normalized_patterns = []
15
+ for pattern in patterns:
16
+ pattern = pattern.replace('\\', '/')
17
+ if pattern.endswith('/') or pattern.endswith('/*'):
18
+ pattern = pattern.rstrip('/*')
19
+ normalized_patterns.append(pattern)
20
+
21
+ # Traverse directories
22
+ for root, dirs, files in os.walk(path_to_scan):
23
+ remove_dir_list = []
24
+
25
+ # (1) Directory matching
26
+ for d in dirs:
27
+ dir_name = d
28
+ dir_path = os.path.relpath(os.path.join(root, d), path_to_scan).replace('\\', '/')
29
+ matched = False
30
+
31
+ for pat in normalized_patterns:
32
+ # Match directory name
33
+ if fnmatch.fnmatch(dir_name, pat):
34
+ matched = True
35
+
36
+ # Match the full relative path
37
+ if not matched:
38
+ if fnmatch.fnmatch(dir_path, pat) or fnmatch.fnmatch(dir_path, pat + "/*"):
39
+ matched = True
40
+
41
+ # If matched, exclude all files under this directory and stop checking patterns
42
+ if matched:
43
+ sub_root_path = os.path.join(root, d)
44
+ for sr, _, sf in os.walk(sub_root_path):
45
+ for sub_file in sf:
46
+ sub_file_path = os.path.relpath(os.path.join(sr, sub_file), path_to_scan)
47
+ excluded_paths.add(sub_file_path.replace('\\', '/'))
48
+ remove_dir_list.append(d)
49
+ break
50
+
51
+ # (1-2) Prune matched directories from further traversal
52
+ for rd in remove_dir_list:
53
+ dirs.remove(rd)
54
+
55
+ # (2) File matching
56
+ for f in files:
57
+ file_path = os.path.relpath(os.path.join(root, f), path_to_scan).replace('\\', '/')
58
+ for pat in normalized_patterns:
59
+ if fnmatch.fnmatch(file_path, pat) or fnmatch.fnmatch(file_path, pat + "/*"):
60
+ excluded_paths.add(file_path)
61
+ break
62
+
63
+ return sorted(excluded_paths)
@@ -157,6 +157,7 @@ def check_output_formats_v2(output='', formats=[], customized_format={}):
157
157
  if not output_extensions:
158
158
  output_extensions = ['.xlsx']
159
159
  if not formats:
160
+ formats = []
160
161
  for ext in output_extensions:
161
162
  for key, value in support_format.items():
162
163
  if value == ext:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fosslight-util
3
- Version: 2.1.7
3
+ Version: 2.1.9
4
4
  Summary: FOSSLight Util
5
5
  Home-page: https://github.com/fosslight/fosslight_util
6
6
  Author: LG Electronics
@@ -5,9 +5,10 @@ fosslight_util/constant.py,sha256=Ig3ACm9_QirE4389Wt-IfxOqRkVOUjqGnX1B05z2Byo,21
5
5
  fosslight_util/correct.py,sha256=3iUipan8ZX8sbyIIGAPtMkAGvZ4YucjeJwx1K1Bx_z4,3897
6
6
  fosslight_util/cover.py,sha256=qqqKzxqFwKimal764FaugRUBcHWdeKt8af6xeK0mH8E,2040
7
7
  fosslight_util/download.py,sha256=bCKvW76XJTnKMAUW5sJZxg_wBUhiybXovJuL04W4P4c,16364
8
+ fosslight_util/exclude.py,sha256=lrVkIoLZsx8XtVL2NErimYlvk4_gyL23OPEnoPT5gSU,2374
8
9
  fosslight_util/help.py,sha256=M3_XahUkP794US9Q0NS6ujmGvrFFnKBHsTU95Fg1KpA,2181
9
10
  fosslight_util/oss_item.py,sha256=8W2HlwqGH3l1iPPdvycrRYKsBSBpqAkqYyYtBVPgMtY,6868
10
- fosslight_util/output_format.py,sha256=AdQVzCpar6n3PCDtijLWbJyFAGKQVE7JhLXlHPtITH4,8678
11
+ fosslight_util/output_format.py,sha256=SdgsATpJNLEKfz0YroVjZG2qDkO9ix0eNUfK_RZ0wB4,8699
11
12
  fosslight_util/parsing_yaml.py,sha256=2zx_N5lMkXT1dRmfJMpzlrru-y_2F_CkVbGlba6vQpU,5380
12
13
  fosslight_util/read_excel.py,sha256=-QvrdxaNqYOpIm1H7ZqIEh5NLvFPymZo6BAOZcQmQug,5263
13
14
  fosslight_util/set_log.py,sha256=Xpa94AiOyGEK8ucaYkvkAllvlen1Pq_d6UG6kPYBYBc,3780
@@ -23,9 +24,9 @@ fosslight_util/write_yaml.py,sha256=QlEKoIPQsEaYERfbP53TeKgnllYzhLQWm5wYjnWtVjE,
23
24
  fosslight_util/resources/frequentLicenselist.json,sha256=GUhzK6tu7ok10fekOnmVmUgIGRC-acGABZKTNKfDyYA,4776157
24
25
  fosslight_util/resources/frequent_license_nick_list.json,sha256=ryU2C_6ZxHbz90_sUN9OvI9GXkCMLu7oGcmd9W79YYo,5005
25
26
  fosslight_util/resources/licenses.json,sha256=mK55z-bhY7Mjpj2KsO1crKGGL-X3F6MBFQJ0zLlx010,240843
26
- fosslight_util-2.1.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
27
- fosslight_util-2.1.7.dist-info/METADATA,sha256=_SbQsVJDKbUmd3C0i1fs7C-B9z92g_SLHWrQVb2mi_s,6499
28
- fosslight_util-2.1.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
29
- fosslight_util-2.1.7.dist-info/entry_points.txt,sha256=bzXX5i7HZ13V8BLKvtu_9KO3ZjtRypH-XszOXT6I3bU,69
30
- fosslight_util-2.1.7.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
31
- fosslight_util-2.1.7.dist-info/RECORD,,
27
+ fosslight_util-2.1.9.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
28
+ fosslight_util-2.1.9.dist-info/METADATA,sha256=9H6NCZXzFELO7SAulU7rNBjQ2lnfsRmrNLHUhNIQVBs,6499
29
+ fosslight_util-2.1.9.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
30
+ fosslight_util-2.1.9.dist-info/entry_points.txt,sha256=bzXX5i7HZ13V8BLKvtu_9KO3ZjtRypH-XszOXT6I3bU,69
31
+ fosslight_util-2.1.9.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
32
+ fosslight_util-2.1.9.dist-info/RECORD,,