Use pathlib in toolshed and ci helper scripts (part 7 of #2410) - #2496
Open
LeSingh1 wants to merge 1 commit into
Open
Use pathlib in toolshed and ci helper scripts (part 7 of #2410)#2496LeSingh1 wants to merge 1 commit into
LeSingh1 wants to merge 1 commit into
Conversation
Part 7 of the series proposed in NVIDIA#2410. Path joining and filesystem predicates in the toolshed and ci/tools helper scripts now go through pathlib. glob.glob in dump_cutile_b64.py becomes Path.glob, with the mtime key reading Path.stat(). Kept on os.path, with a comment where it is not obvious: - os.path.abspath in build_static_bitcode_input.py, since sys.path wants a str and Path.absolute() does not normalize. - os.path.isfile in check_generated_file_seals.py. That guard exists to skip anything that is not a readable regular file, and Path.is_file() is not a drop-in: it propagates OSError for errnos outside pathlib's ignore list (EACCES, ENAMETOOLONG) where os.path.isfile returns False. - os.path.normpath in check_spdx.py, which already carries its own comment. The plan on NVIDIA#2410 also listed a root conftest.py; there is no such file. The three conftest.py files live under cuda_pathfinder, cuda_core and cuda_bindings, and none of them use os.path. Verified locally: ci/tools/tests/test_check_release_notes.py passes (42 tests), and check_spdx.py and check_generated_file_seals.py produce output identical to the pre-change scripts when run over every tracked .py file. Signed-off-by: LeSingh1 <sshaurya914@gmail.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Path joining and filesystem predicates in the helper scripts, plus
glob.glob→Path.globindump_cutile_b64.py.os.path.isfilestays incheck_generated_file_seals.py: that guard skips anything that is not a readable regular file, andPath.is_file()raises onEACCES/ENAMETOOLONGwhereos.path.isfilereturnsFalse.os.path.abspathstays wheresys.pathneeds astr.Not covered by the
cuda_pathfinderCI job, so I verified locally instead:ci/tools/tests/test_check_release_notes.pypasses (42 tests), and both pre-commit hooks produce output identical to the pre-change scripts when run over every tracked.pyfile.Part 7 of #2410.
Parts 5 and 6 (
cuda_coreandcuda_bindings, largelybuild_hooks.py) are not ready — I have no way to run a wheel build here, and given thePath.is_file()divergence noted on #2410 I would rather not ship unverifiable build-system path changes.