Repository navigation
Conversation
`make install` writes `build-details.json` (PEP 739) with absolute paths, so the file is wrong once the installation is moved. Fixing that is one of the steps towards relocatable CPython installations. PEP 739 allows the paths to be relative to `base_prefix`, and `base_prefix` to be relative to the file's directory; `generate-build-details.py` already implements that behind `--relative-paths --config-file-path`. Pass those flags from the Makefile. The installed-file tests now resolve the paths like a consumer would, instead of skipping on a relocated installation. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ff84334 to
22c061e
Compare
Documentation build overview
16 files changed ·
|
`make install prefix=...` (which the Android build uses) changes
`$(LIBDEST)` but not the prefix that `sysconfig` reports, so
`base_prefix` was computed between two unrelated paths. Add an
`--installed-location` flag that uses `sysconfig.get_path('stdlib')`.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
FFY00
left a comment
There was a problem hiding this comment.
The PR looks good to me 👍
Though, I think it would be best if we kept the default behavior, and instead add a configure flag for relocatable install. What do you think?
|
thanks for the review @FFY00 !
We can do that (assuming I merge gh-162185 first, so we have the flag), but my preference would be to make the default behavior relocatable-friendly whenever we can. This PR is actually a good example of why that's beneficial - by making the change in the default build, I could get good CI signal (without adding a new CI dimension), which flagged a gap in my initial approach (i.e., this Android failure). If the change was behind a flag, I wouldn't have known about that case, and wouldn't adjust the approach with the second commit in this PR. Having said that, if making build-details paths relative in the default build would cause issues for users in practice, that would be a good reason to keep the default behavior and use the flag. Can you think of any? |
Conflict in Lib/test/test_build_details.py: both sides added tests after test_location; keep both. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
make installwritesbuild-details.json(PEP 739) with absolute paths, so the file is wrong once the installation is moved. Fixing that is one of the steps towards relocatable CPython installations.PEP 739 allows the paths to be relative to
base_prefix, andbase_prefixto be relative to the file's directory;generate-build-details.pyalready implements that behind--relative-paths --config-file-path. The Makefile now passes--relative-pathswith a new--installed-locationflag, which takes the file's installed path fromsysconfiginstead of from$(LIBDEST), so thatmake install prefix=...(which the Android build uses) doesn't change the result.The installed-file tests now resolve the paths like a consumer would, instead of skipping on a relocated installation.