[no-ci] cuda_core: fix SPDX identifiers and enforce Apache-2.0 headers#1897
[no-ci] cuda_core: fix SPDX identifiers and enforce Apache-2.0 headers#1897rwgk wants to merge 5 commits intoNVIDIA:mainfrom
Conversation
Refactor the SPDX checker so package-specific license rules can be enforced cleanly while preserving the existing autofix flow. Keep focused regression coverage alongside the toolshed script instead of in routine package test collection. Made-with: Cursor
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test |
|
toolshed/check_spdx.py
Outdated
| normalized_path = filepath.replace("\\", "/") | ||
| while normalized_path.startswith("./"): | ||
| normalized_path = normalized_path[2:] | ||
| return normalized_path |
There was a problem hiding this comment.
How does this differ from / why doesn't it use os.path.normpath?
There was a problem hiding this comment.
Cursor found a better implementation. I asked it to add a full explanation. Please take another look:
commit eef3902
toolshed/test_check_spdx.py
Outdated
| assert "OUTDATED copyright '2024' (expected '2026')" in capsys.readouterr().out | ||
| assert "Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved." in path.read_text( | ||
| encoding="ascii" | ||
| ) |
There was a problem hiding this comment.
I think we should add this to CI or just remove it. It's only going to bitrot if it sits here.
… CI, but it will bit-rot if untested).
Use a standard-library path normalizer so repo-prefix checks treat Windows-style paths consistently on any host. Document why os.path.normpath is not suitable for this forward-slash prefix comparison. Made-with: Cursor
|
I added I'll push updates to |
Summary
cuda_core/SPDX-License-Identifierheaders so they consistently useApache-2.0.toolshed/check_spdx.pyso expected license identifiers can be enforced by path prefix, and requireApache-2.0for files undercuda_core/.toolshed/test_check_spdx.pyfor the newcuda_core/rule, path normalization, and the existing staged-file copyright autofix flow.Validation
pre-commit run --all-filespixi run --manifest-path "cuda_pathfinder" pytest toolshed/test_check_spdx.py -q