-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Patch pkg-config files to be relocatable #11291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -347,9 +348,15 @@ fn patch_pkgconfig(contents: &str, real_prefix: &Path) -> String { | |||
return Cow::Borrowed(line); | |||
} | |||
|
|||
Cow::Owned(format!("{}={}", prefix, real_prefix.display())) | |||
changed = true; | |||
Cow::Owned(format!("{}=${{pcfiledir}}/../..", prefix)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean we aren't applying this to .pc
files that we've already patched? Since, in that case, I guess the RHS of the =
would not be /install
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, but does the comment above
// Given, e.g.,
prefix=/install
, replace withprefix=/real/prefix
.
Need to be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind if we avoid patching already patched .pc
files without --reinstall
, though I would have to double check how the patch on reinstall behavior works in practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, does --reinstall
not delete and re-unpack the entire directory? I don't follow the whole flow of this code but that surprises me if so.
(Or do you mean that this doesn't apply to .pc files that we patched during the python-build-standalone release process? Yes.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I believe --reinstall
does delete and re-unpack the entire directory. I was referring to the case of: you run uv python install 3.12
, and 3.12
is already installed. In that case, we do call through to these patch routines, but I don't think this patch would take effect (since the already-patched .pc
file wouldn't match the above pattern). I defer to you two on whether that's important (seems fine).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it seems fine without an explicit reinstall. Thanks for clarifying the behavior.
Previously, we patched pkg-config .pc files to have the absolute path to the directory where we unpack a python-build-standalone release. As discussed in astral-sh#11028, we can use ${pcfiledir} in a .pc file to indicate paths relative to the location of the file itself. This change was implemented in astral-sh/python-build-standalone#507, so for newer python-build-standalone releases, we don't need to do any patching. Optimize this case by only modifying the .pc file if an actual change is needed (which might be helpful down the line with hard links or something). For older releases, change uv's patch to match what python-build-standalone now does.
6166c4b
to
f13fe17
Compare
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.5.29` -> `0.5.30` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>astral-sh/uv (astral-sh/uv)</summary> ### [`v0.5.30`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0530) [Compare Source](astral-sh/uv@0.5.29...0.5.30) ##### Python The managed PyPy distributions have been updated for PyPy v7.3.18, which includes: - PyPy3.10, which updates the standard library from Python 3.10.14 to 3.10.19 - PyPy3.11, which adds beta support for Python 3.11.11 See the [PyPy release](https://pypy.org/posts/2025/02/pypy-v7318-release.html) for more details. ##### Enhancements - Add `uv sync --dry-run` ([#​11299](astral-sh/uv#11299)) - Ignore `#egg` fragment in HTML Simple API response ([#​11340](astral-sh/uv#11340)) ##### Configuration - Add `NO_BINARY` and `NO_BINARY_PACKAGE` environment variables ([#​11399](astral-sh/uv#11399)) ##### Performance - Avoid re-cloning name when populating ambiguous set ([#​11401](astral-sh/uv#11401)) - Optimize flattening in large workspaces ([#​11313](astral-sh/uv#11313)) ##### Bug fixes - Allow dynamic packages to be overloaded ([#​11400](astral-sh/uv#11400)) - Fix credential caching for index roots when URL ends in `simple/` ([#​11336](astral-sh/uv#11336)) - Fix marker merging for requirements.txt for psycopg ([#​11298](astral-sh/uv#11298)) - Set 777 permissions on locked files ([#​11328](astral-sh/uv#11328)) - Support extras in `@` requests for tools ([#​11335](astral-sh/uv#11335)) - Upgrade `astral-tokio-tar` to v0.5.1 ([#​11359](astral-sh/uv#11359)) - Avoid missing logging for no-op upgrade events ([#​11301](astral-sh/uv#11301)) - Use refined specifiers when logging narrowed Python range ([#​11334](astral-sh/uv#11334)) - Don't use popup-generating `eprintln` in trampoline warnings ([#​11295](astral-sh/uv#11295)) - Patch pkg-config files to be relocatable ([#​11291](astral-sh/uv#11291)) - Fix a case of duplicate `torch` packages when using conflicting extras ([#​11323](astral-sh/uv#11323)) ##### Documentation - Add docs for `uv tool install --editable` ([#​11280](astral-sh/uv#11280)) - Fix broken anchors in README and docs index ([#​11338](astral-sh/uv#11338)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjQuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2NC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Previously, we patched pkg-config .pc files to have the absolute path to the directory where we unpack a python-build-standalone release. As discussed in #11028, we can use ${pcfiledir} in a .pc file to indicate paths relative to the location of the file itself.
This change was implemented in astral-sh/python-build-standalone#507, so for newer python-build-standalone releases, we don't need to do any patching. Optimize this case by only modifying the .pc file if an actual change is needed (which might be helpful down the line with hard links or something). For older releases, change uv's patch to match what python-build-standalone now does.