Repository navigation
fix: support older bootstrap Python - #1518
rksharma-owg wants to merge 1 commit into
Conversation
|
Hi @rksharma-owg! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
@christycylee has imported this pull request. If you are a Meta employee, you can view this in D135755968. (Because this pull request was imported automatically, there will not be any future comments.) |
Summary: Replace the Python 3.12-only Path.relative_to(walk_up=True) call in the Rust build-script shim with os.path.relpath. ## Problem The default system Python bootstrap toolchain can invoke from_any_dir.py with Python versions before 3.12, causing TypeError: relative_to() got an unexpected keyword argument 'walk_up' for Rust build scripts that compile C. ## Root Cause Path.relative_to(walk_up=True) is unavailable before Python 3.12, but the system bootstrap toolchain uses the host python3 without enforcing that minimum. ## Fix Use os.path.relpath, preserving the existing relative-path behavior without imposing a Python 3.12 requirement. ## Tests - python3.11 prelude/rust/tools/from_any_dir_test.py - python3 prelude/rust/tools/from_any_dir_test.py - python3 -m py_compile prelude/rust/tools/from_any_dir.py prelude/rust/tools/from_any_dir_test.py - Fork GitHub Actions matrix: Linux, macOS, and Windows passed (run 36185760647: https://github.com/rksharma-owg/buck2/actions/runs/36185760647). Scope is intentionally limited to the Rust build-script path shim. Fixes meta/buck2#1490 X-link: meta/buck2#1518 Reviewed By: dtolnay Differential Revision: D135755968 Pulled By: christycylee fbshipit-source-id: 4c62d18d1bc912fbb6d73eb40183ed8f4abb7b68
|
@christycylee merged this pull request in 17bf203. |
Summary
Replace the Python 3.12-only Path.relative_to(walk_up=True) call in the Rust build-script shim with os.path.relpath.
Problem
The default system Python bootstrap toolchain can invoke from_any_dir.py with Python versions before 3.12, causing TypeError: relative_to() got an unexpected keyword argument 'walk_up' for Rust build scripts that compile C.
Root Cause
Path.relative_to(walk_up=True) is unavailable before Python 3.12, but the system bootstrap toolchain uses the host python3 without enforcing that minimum.
Fix
Use os.path.relpath, preserving the existing relative-path behavior without imposing a Python 3.12 requirement.
Tests
Scope is intentionally limited to the Rust build-script path shim.
Fixes #1490