Fix Python interpreter discovery on non-glibc hosts#9005
Merged
konstin merged 1 commit intoastral-sh:mainfrom Nov 21, 2024
Merged
Fix Python interpreter discovery on non-glibc hosts#9005konstin merged 1 commit intoastral-sh:mainfrom
konstin merged 1 commit intoastral-sh:mainfrom
Conversation
a264ac5 to
d7f9792
Compare
samypr100
reviewed
Nov 11, 2024
Comment on lines
478
to
480
| else: | ||
| print(json.dumps({"result": "error", "kind": "libc_not_found"})) | ||
| sys.exit(0) |
Collaborator
There was a problem hiding this comment.
Given the declared wheel format in PEP-738, rather than allowing passing through the glibc version as (-1, -1)/(0, 0), I wonder if it's worthwhile considering using sys.getandroidapilevel here since it's compatible since 3.7+.
PEP-738 also introduced platform.android_ver, but sadly it's only available in 3.13.
e.g.
elif glibc_version != (-1, -1):
operating_system = {
"name": "manylinux",
"major": glibc_version[0],
"minor": glibc_version[1],
}
elif hasattr(sys, "getandroidapilevel"):
operating_system = {
"name": "android",
"major": sys.getandroidapilevel(),
"minor": 0,
}
else:
print(json.dumps({"result": "error", "kind": "libc_not_found"}))
sys.exit(0)...
elif os_and_arch["os"]["name"] == "android":
manylinux_compatible = False
konstin
requested changes
Nov 14, 2024
Member
konstin
left a comment
There was a problem hiding this comment.
I agree with @samypr100, we need a way to specifically check for android; we had cases where the error branch caught bugs in the past
Termux on Android has a Python linked against bionic, which is not glibc or manylinux compatible. Currently uv fails to discover Termux's Python interpreters even though they are fully functional. This change detects when the Python interpreter is running on Android, and adds a new OS variant for Android.
Contributor
Author
|
Ok, I think I've done it. Manual testing seems to work. |
konstin
approved these changes
Nov 21, 2024
jooon
added a commit
to jooon/uv
that referenced
this pull request
Nov 21, 2024
_get_glibc_version() can after astral-sh#9005 return either (0, 0) if glibc string is missing or (-1, -1) if the string can't be parsed. There was no need to change missing string to (0, 0). Also, move back indentation to make it easier to understand.
charliermarsh
pushed a commit
that referenced
this pull request
Nov 21, 2024
_get_glibc_version() can after #9005 return either (0, 0) if glibc string is missing or (-1, -1) if the string can't be parsed. There was no need to change missing string to (0, 0). Also, move back indentation to make it easier to understand.
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Nov 28, 2024
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.5.4` -> `0.5.5` | 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.5`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#055) [Compare Source](astral-sh/uv@0.5.4...0.5.5) ##### Enhancements - Add aliases for build backend requests ([#​9294](astral-sh/uv#9294)) - Avoid displaying empty paths ([#​9312](astral-sh/uv#9312)) - Allow constraints in `uv tool upgrade` ([#​9375](astral-sh/uv#9375)) - Remove conflict between `--no-sync` and `--frozen` in `uv run` ([#​9400](astral-sh/uv#9400)) - Respect dependency sources in overrides and constraints ([#​9455](astral-sh/uv#9455)) - Show an interpreter-focused message for `--target` and `--prefix` ([#​9373](astral-sh/uv#9373)) - Add `--no-extra` flag and setting ([#​9387](astral-sh/uv#9387)) - Add `uv export --prune` ([#​9389](astral-sh/uv#9389)) - Add dedicated error message for musl install attempts ([#​9430](astral-sh/uv#9430)) - Add various grammar changes to conflict error messages ([#​9369](astral-sh/uv#9369)) - Annotate default groups in conflict error messages ([#​9368](astral-sh/uv#9368)) - Report marker diagnostics during parsing, rather than evaluation ([#​9338](astral-sh/uv#9338)) - Use consistent formatting for build system errors ([#​9340](astral-sh/uv#9340)) - Use rich diagnostics for build failures ([#​9335](astral-sh/uv#9335)) ##### Preview features - Improve build backend excludes ([#​9281](astral-sh/uv#9281)) - Include PEP 639 `license-files` metadata during `uv publish` ([#​9442](astral-sh/uv#9442)) ##### Performance - Initialize rayon lazily ([#​9435](astral-sh/uv#9435)) - Migrate to PubGrub's arena for package names ([#​9448](astral-sh/uv#9448)) ##### Bug fixes - Allow dependency groups to include the containing package ([#​9385](astral-sh/uv#9385)) - Allow syncing to empty virtual environment directories ([#​9427](astral-sh/uv#9427)) - Allow system Python discovery with `--target` and `--prefix` ([#​9371](astral-sh/uv#9371)) - Don't warn when `--output-file` is empty ([#​9417](astral-sh/uv#9417)) - Fix Python interpreter discovery on non-glibc hosts ([#​9005](astral-sh/uv#9005)) - Fix `tool.uv.dependency-metadata.[].version` schema ([#​9468](astral-sh/uv#9468)) - Only respect preferences across the same indexes ([#​9302](astral-sh/uv#9302)) - Re-compile when `--compile` is passed to an install operation ([#​9378](astral-sh/uv#9378)) - Remove `--upgrade`, `--no-upgrade`, and `--upgrade-package` from `uv tool upgrade` ([#​9318](astral-sh/uv#9318)) - Remove dev dependencies in `--all-groups --no-dev` ([#​9300](astral-sh/uv#9300)) - Surface extras and group conflicts in `uv export` ([#​9365](astral-sh/uv#9365)) - Treat deprecated aliases as equivalent in marker algebra ([#​9342](astral-sh/uv#9342)) - Treat less compatible tags as lower priority in resolver ([#​9339](astral-sh/uv#9339)) ##### Documentation - Avoid referencing `scikit-build` (instead of `scikit-build-core`) ([#​9320](astral-sh/uv#9320)) - Expand entry points documentation ([#​9329](astral-sh/uv#9329)) - Fix example `pyproject.toml` in project concept documentation ([#​9298](astral-sh/uv#9298)) - Fix header level of "Conflicting dependencies" page ([#​9330](astral-sh/uv#9330)) - Touch-up the extension module guide ([#​9293](astral-sh/uv#9293)) - Update the dependencies documentation ([#​9359](astral-sh/uv#9359)) - Reference `--no-progress` option in related environment variable ([#​9357](astral-sh/uv#9357)) </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:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
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
On Termux, uv currently fails to find any interpreter because it can't find a glibc version, because there isn't one. But the Python interpreter is still functional nonetheless.
So, when glibc cannot be found, simply return 0 for the version numbers and mark the interpreter as being incompatible with manylinux
I really don't know if this is the right way to address this, but I can attest that manual testing shows uv appears to be fully functional, at least for pip and virtualenvs.
Fixes #7373
Test Plan
I tried running the test suite, and after some tweaks, a good portion of the test suite passes as well. A significant number of tests fail, but this appears to be due to minor differences in output, like warnings about hard links not working (hard links are completely disallowed on Android), differences in the number of files removed, etc. The test suite seems to be very sensitive to minor variations in output.