← Back to issue list

repo: fix all python shebangs in stage-packages

View original Github issue

Metadata

Project
snapcraft
Number
#2112
Type
pull request
State
merged
Author
kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

PR #2112 (commit 829adaec4) merged: snapcraft now rewrites Python shebangs across the whole part instead of only bin/, and drops archived sitecustomize.py, fixing LP: #1766662.

Resolution: closed resolved

Reason: The pull request itself was merged into the repo as commit 829adaec4 ("repo: fix all python shebangs in stage-packages (#2112)"), approved by a maintainer reviewer. It made stage-packages shebang fixing consistent with the python plugin (whole part, not just bin) and removed the staged sitecustomize.py, resolving Launchpad bug #1766662.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved PR #2112 (commit 829adaec4) merged: snapcraft now rewrites Python shebangs across the whole part instead of only bin/, and drops archived sitecustomize.py, fixing LP: #1766662.
stealth/space-bunny-alpha — closed resolved Merged PR #2112 (commit 829adaec4) by kyrofa: stage-packages now get Python shebangs rewritten across the whole part, not just bin/, and the archived sitecustomize.py is stripped, fixing LP: #1766662.
stealth/space-bunny-alpha — closed resolved Merged #2112 (commit 829adaec4) fixed Python shebang rewriting throughout stage-packages and removed archived sitecustomize.py to prevent part clashes, resolving LP: #1766662.
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.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: snapcraft#1719 (confidence 40%)

    Earlier merged PR 8ed95e68a unified the Python shebang rewrite logic and accounted for shebang args; same area of code touched by #2112.

  • Related To: snapcraft#3320 (confidence 30%)

    Later python v2 plugin work (d1d8a9414) continued shebang interpreter consistency for staged python parts.

Related issues

Issue Project State Summary Similarity
#1766662 python shebang rewriting can fail in presence of a stage-package snapcraft (launchpad) closed Fixed by merged canonical/snapcraft PR #2112 (commit 829adaec4), broadening Python shebang rewriting from bin directories to all stage-packages so later parts stage successfully.
82%
#1486680 snapcraft plugin for python2/3 should fix incorrect shebang on pkg_resources-generated scripts snapcraft (launchpad) closed Fixed by snapcraft#1719 (commit 8ed95e68a), which updated Python shebang rewriting to handle pkg_resources-generated console scripts with interpreter arguments.
74%
#1673451 fix shebangs should fix versioned python snapcraft (launchpad) closed Fixed by merged snapcore/snapcraft PR #1719, which made shebang rewriting account for versioned Python interpreters.
74%