Strip toolchain bin paths from sysconfig AR variable#1127
Open
kimjune01 wants to merge 2 commits into
Open
Conversation
Fixes astral-sh#1073 The AR sysconfig variable contains an absolute build-time path (e.g., /tools/llvm/bin/llvm-ar) instead of just the tool name (llvm-ar). CC and CXX are already normalized by CPython, but AR and RANLIB are not. This change adds path normalization in hack_sysconfig.py to strip the toolchain bin directory prefix from all occurrences in sysconfig artifacts (PYTHON_CONFIG, Makefile, SYSCONFIGDATA). The fix: - Uses os.path.normpath to handle edge cases like trailing slashes - Also catches resolved symlinks (e.g., macOS /var vs /private/var) - Preserves LLVM tool names (llvm-ar, not ar) for consistency with CC=clang and CXX=clang++ Reviewed by: codex (GPT-5.5), gemini-3.1-pro-preview
- Added test case: 'AR = /tools/llvm/bin/' -> 'AR = ' - Documents expected behavior when path ends with trailing slash - Validates replacement doesn't crash on degenerate inputs
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.
Summary
/varvs/private/var) as a second passTest plan
python3 test_ar_normalization.py: all 8 test cases passed