|
14 | 14 | from ._scan_item import replace_word |
15 | 15 | from ._scan_item import is_notice_file |
16 | 16 | from ._scan_item import is_manifest_file |
| 17 | +from ._scan_item import is_package_dir |
17 | 18 | from typing import Tuple |
18 | 19 |
|
19 | 20 | logger = logging.getLogger(constant.LOGGER_NAME) |
@@ -99,6 +100,13 @@ def parsing_scancode_32_earlier(scancode_file_list: list, has_error: bool = Fals |
99 | 100 | copyright_list = file.get("copyrights", []) |
100 | 101 |
|
101 | 102 | result_item = SourceItem(file_path) |
| 103 | + is_pkg, pkg_path = is_package_dir(os.path.dirname(file_path)) |
| 104 | + if is_pkg: |
| 105 | + result_item.source_name_or_path = pkg_path |
| 106 | + if not any(x.source_name_or_path == result_item.source_name_or_path for x in scancode_file_item): |
| 107 | + result_item.exclude = True |
| 108 | + scancode_file_item.append(result_item) |
| 109 | + continue |
102 | 110 |
|
103 | 111 | if has_error and "scan_errors" in file: |
104 | 112 | error_msg = file.get("scan_errors", []) |
@@ -235,6 +243,13 @@ def parsing_scancode_32_later( |
235 | 243 | continue |
236 | 244 |
|
237 | 245 | result_item = SourceItem(file_path) |
| 246 | + is_pkg, pkg_path = is_package_dir(os.path.dirname(file_path)) |
| 247 | + if is_pkg: |
| 248 | + result_item.source_name_or_path = pkg_path |
| 249 | + if not any(x.source_name_or_path == result_item.source_name_or_path for x in scancode_file_item): |
| 250 | + result_item.exclude = True |
| 251 | + scancode_file_item.append(result_item) |
| 252 | + continue |
238 | 253 |
|
239 | 254 | if has_error: |
240 | 255 | error_msg = file.get("scan_errors", []) |
|
0 commit comments