repo: fix all python shebangs in stage-packages
Metadata
Current evaluation
Merged fix aligns Python shebang replacement in stage-packages with standard plugin behavior, applying it throughout the entire part instead of only bin directories. Removes sitecustomize.py to prevent part clashes. Resolves LP: #1766662.
Suggested action: —
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
Snapcraft's python plugin fixes python shebangs throughout the entire part. However, when using stage-packages, snapcraft only fixes python shebangs in bin directories. This makes combining them in one `snapcraft.yaml` difficult as they always conflict.
This PR fixes [LP: #1766662](https://bugs.launchpad.net/snapcraft/+bug/1766662) by making this behavior consistent, always fixing python shebangs throughout the entire part. It also removes the `sitecustomize.py` coming from the archive, since it's never useful and can cause clashes between parts.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix aligns Python shebang replacement in stage-packages with standard plugin behavior, applying it throughout the entire part instead of only bin directories. Removes sitecustomize.py to prevent part clashes. Resolves LP: #1766662. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Updated stage-packages to fix Python shebangs across the entire part rather than only bin directories, eliminating conflicts when combining parts. Also removed sitecustomize.py from archives to prevent clashes. Resolves LP: #1766662. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Python shebangs in stage-packages are now consistently fixed throughout the entire part instead of only in bin directories, resolving part combination conflicts. The update also removes sitecustomize.py from archives to prevent clashes. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #311 plugins: fix python shebang | rockcraft | merged | Merged a fix for the Python shebang in plugins. The change replaces hardcoded interpreters with ${PARTS_PYTHON_INTERPRETER} to respect user overrides. Approved by two reviewers and merged. | |
| #830 python plugin: only replace proper shebangs. | snapcraft | merged | Merged a python plugin fix that restricts shebang replacement to file beginnings. Approved by one reviewer, the change resolves plainbox snap conflicts with a +6/-1 diff across two files. | |
| #680 Rewrite shebangs generated by the python plugins. | snapcraft | merged | Merged changes that rewrite Python plugin shebangs to use env instead of hardcoded paths, resolving Launchpad bug #1597919. After adding requested integration tests, the changes were approved and merged across 13 files. |