python v2 plugin: fix multiple python parts with staged python
Metadata
Current evaluation
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.
Suggested action: —
No scores available.
Issue body
Fix a regression where snaps with multiple python parts and staged
python packages may cause a file conflict & broken (unused) symlink.
When creating a venv with "/usr/bin/python3", the venv will populate
symlinks for:
/bin/python
/bin/python3
When creating a venv with "/usr/bin/python3.8", the venv will populate
symlinks for:
/bin/python
/bin/python3
/bin/python3.8
By resolving the interpreter prior to using it, the venvs were getting
an additional symlink which are not being fixed up like "python3",
or $SNAPCRAFT_PYTHON_INTERPRETER.
Should SNAPCRAFT_PYTHON_INTERPRETER be set to a more specific minor
version, either the snap must filter out the additional symlink or the
plugin needs to be updated to correct, or remove, the problematic
links.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for a regression causing file conflicts and broken symlinks when multiple Python parts use staged packages. Resolved the interpreter before venv creation to prevent unmanaged symlinks. Merged into master as PR #3451. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for a regression causing file conflicts and broken symlinks when multiple Python parts use staged packages. Resolved the interpreter prior to venv creation to prevent unhandled symlinks. Merged into master. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3320 python v2 plugin: consistent linking for interpreter | snapcraft | merged | 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. | |
| #6411 The Python plugin can create conflicting interpreters | snapcraft | open | Python plugin creates conflicting interpreters on core26 when staging Python via stage-packages; shebangs should point to /bin/python3 |