← Back to issue list

python plugin: do not leak snapcraft's site-packages

View original Github issue

Metadata

Project
snapcraft
Number
#2901
Type
pull request
State
merged
Author
sergiusens
Labels
Created
Updated
Closed

Current evaluation

Merged fix preventing the Python plugin from leaking snapcraft site-packages during builds. sitecustomize now conditionally exports $SNAP/site-packages only when SNAPCRAFT_INTERPRETER is set, resolving build environment pollution.

Suggested action:

No scores available.

Issue body

The current sitecustomize generated by the python plugin always considers adding site-packages from $SNAP which is only meant for runtime. This is a problem as snapcraft runs in the context of a snap, so $SNAP always exists in the environment. When building, snapcraft exports SNAPCRAFT_INTERPRETER, use this as a condition to export site-packages found under $SNAP. LP: #1860884 Signed-off-by: Sergio Schvezov <sergio.schvezov@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 preventing the Python plugin from leaking snapcraft site-packages during builds. sitecustomize now conditionally exports $SNAP/site-packages only when SNAPCRAFT_INTERPRETER is set, resolving build environment pollution.
qwen3.6-35b-a3b-mtp-q6 Merged a fix preventing the Python plugin from leaking snapcraft's site-packages during builds. The change conditionally exports SNAP site-packages only when SNAPCRAFT_INTERPRETER is set, resolving LP #1860884.
qwen3.6-35b-a3b-mtp-q6 Merged fix preventing the Python plugin from leaking snapcraft's site-packages during build time. The updated sitecustomize now uses the SNAPCRAFT_INTERPRETER environment variable to conditionally export SNAP paths only at runtime, resolving LP #1860884.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2161191 python plugin messing with snapcraft env snapcraft (launchpad) open Python plugin leaking snapcraft's site-packages into builds, causing environment pollution. This issue appears to describe the same problem fixed in snapcraft#2901.
81%