fix(scripts): resolve the interpreter before building .venv - #150
Merged
Merged
Conversation
'uv python find' may answer a symlink (for example a ~/.local/bin shim into an extracted toolchain). A --copies venv records that link's directory as home, so the copied binary resolves <home>/../lib and loses its stdlib: ensurepip dies with 'no module named encodings' and the module-pin verification lane cannot build the environment. Resolve the real path first; on a real interpreter the call is a no-op. Signed-off-by: rldyourmnd <danil@nddev.it.com>
This was referenced Oct 4, 2026
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
uv python find 3.13.14can return a symlink (here:~/.local/bin/python3.13→ the nddev toolchain).python -m venv --copiesthen writeshome = <link dir>into pyvenv.cfg, the copied binary resolves<link dir>/../lib/python3.13for its stdlib, finds nothing, andensurepipfails — which is what blocked the estate's module-pin verification lane (GDS_MODULE_VERIFICATION_COMMAND_FAILED, lanetest).Resolving
os.path.realpath(sys.executable)first makeshomethe real toolchainbin/, and is a no-op wherever the interpreter is already a real file.Permissions diff
None — shell script, no workflow surfaces touched.
Threat-model note
The interpreter path now passes through the interpreter's own
realpathbefore use; it can only resolve to a target the found binary already points to — no new trust edge.Test plan
~/.local/bin/python3.13 -m venv --copies→ encodings missing, ensurepip exit 1validate_module.shbuilds.venv(home = real toolchain) andvalidate_all (core): OK— 45 lanes greenGenerated with Devin