many: account for python shebang args in rewrite
Metadata
Current evaluation
Merged #1719 as commit 8ed95e68a, preserving Python shebang arguments and centralizing rewrites; fixes LP bugs #1730472 and #1673451.
Resolution: closed resolved
Reason: PR #1719 was approved and merged into master as commit 8ed95e68a. It handles Python shebang arguments and makes all components use the same rewrite path.
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`?
-----
Currently Snapcraft rewrites absolute Python shebangs to point into the snap by using `/usr/bin/env`. However, `/usr/bin/env` doesn't handle shebang args, whereas Python itself does.
This PR fixes LP: [#1730472](https://bugs.launchpad.net/snapcraft/+bug/1730472) by accounting for the possibility of shebang args in rewrite, and making sure that all components that rewrite the Python shebang use the same code path to do so. As a side effect of this last step, this PR also fixes LP: [#1673451](https://bugs.launchpad.net/snapcraft/+bug/1673451).
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged #1719 as commit 8ed95e68a, preserving Python shebang arguments and centralizing rewrites; fixes LP bugs #1730472 and #1673451. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in canonical/snapcraft#1719 (commit 8ed95e68a), preserving Python shebang arguments during rewrites and unifying rewrite logic; also fixes LP bugs #1730472 and #1673451. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged after reviewer approval and passing tests. Unifies Python shebang rewrite logic to properly handle arguments instead of relying on /usr/bin/env. Resolves Launchpad bugs #1730472 and #1673451. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged after local testing. Updates Snapcraft to handle Python shebang arguments during rewrite, resolving bugs #1730472 and #1673451. Unifies shebang rewriting logic across components. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #680 Rewrite shebangs generated by the python plugins. | snapcraft | merged | Merged PR #680 as commit 066d653b5, rewriting Python plugin shebangs to use env instead of absolute paths and fixing LP #1597919. | |
| #1730472 Python shebang rewrite doesn't support shebang args | snapcraft (launchpad) | closed | Python shebang rewriting now preserves interpreter arguments; fixed by merged PR snapcraft#1719 in commit 8ed95e68a. |