File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- Copyright (c) 2025 -2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+ Copyright (c) 2024 -2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
33 Apache License
44 Version 2.0, January 2004
Original file line number Diff line number Diff line change 3737}
3838
3939SPDX_IGNORE_FILENAME = ".spdx-ignore"
40- PACKAGE_LICENSE_FILES = (
41- "cuda_bindings/LICENSE" ,
42- "cuda_bindings_12/LICENSE" ,
43- )
40+ REPOSITORY_LICENSE_CONTENTS = Path ("LICENSE" ).read_bytes ()
41+
42+
43+ def license_files_match_repository (filepaths ):
44+ licenses_match = True
45+ for filepath in filepaths :
46+ license_path = Path (filepath )
47+ if license_path .name != "LICENSE" :
48+ continue
49+ if license_path .read_bytes () != REPOSITORY_LICENSE_CONTENTS :
50+ print (f"PACKAGE LICENSE { filepath !r} does not match repository LICENSE" )
51+ licenses_match = False
52+ return licenses_match
4453
4554
4655def load_spdx_ignore ():
@@ -208,14 +217,11 @@ def main(args):
208217 else :
209218 fix = False
210219
211- ignore_spec = load_spdx_ignore ()
212-
213220 returncode = 0
214- repository_license = Path ("LICENSE" ).read_bytes ()
215- for license_file in PACKAGE_LICENSE_FILES :
216- if Path (license_file ).read_bytes () != repository_license :
217- print (f"PACKAGE LICENSE { license_file !r} does not match repository LICENSE" )
218- returncode = 1
221+ if not license_files_match_repository (args ):
222+ returncode = 1
223+
224+ ignore_spec = load_spdx_ignore ()
219225
220226 for filepath in args :
221227 if ignore_spec .match_file (filepath ):
You can’t perform that action at this time.
0 commit comments