python v2 plugin: consistent linking for interpreter
Metadata
Current evaluation
Merged fix for Python v2 plugin venv creation failure when the interpreter is staged from another part. Resolved interpreter path, fixed symlink handling, and refactored shell code. Approved, passed CI, and merged.
Suggested action: —
No scores available.
Issue body
When creating a venv, the venv's bin/python[3|3.x] will
always point to the python that created it. There are
three basic cases where python points to:
(1) the base @ /usr/bin/<python> (typical).
(2) $SNAPCRAFT_PART_INSTALL/usr/bin/<python> (staged in the part).
(3) $SNAPCRAFT_STAGE/usr/bin/<python> (staged from another part).
The first two cases were handled previously, when PATH matched
expected environment. The third case may occur when another part
stages prior to the python part.
- Resolve the interpreter before creating the venv. This way it
is apparent which python the venv wil point to, and provide
a hint in case things go wrong (e.g. partial staging of python).
Use this resolved path for the shebang find/replace.
- Fix the broken case where python is resolved to $SNAPCRAFT_STAGE.
Handle it similar to $SNAPCRAFT_PART_INSTALL, making a relative
symlink when found.
- While here, refactor some shell code into functions with logging
(set -x) disabled to reduce logging clutter.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for Python v2 plugin venv creation failure when the interpreter is staged from another part. Resolved interpreter path, fixed symlink handling, and refactored shell code. Approved, passed CI, and merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Resolves Python v2 plugin interpreter linking by resolving paths before venv creation, correctly handling staged environments with relative symlinks, and refactoring shell code to reduce logging clutter. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Fixes Python v2 plugin interpreter linking by resolving the path before venv creation, correcting symlinks for staged parts and refactoring shell code to reduce logging. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3451 python v2 plugin: fix multiple python parts with staged python | snapcraft | merged | Merged fix for Python v2 plugin regression causing file conflicts and broken symlinks with multiple staged Python parts. The update resolves the interpreter before virtual environment creation to prevent unmanaged symlinks. |