Bug 256510 - Mk/Uses/shebang.mk Silently fails on .py files if python env isn't initialized
Summary: Mk/Uses/shebang.mk Silently fails on .py files if python env isn't initialized
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-09 19:24 UTC by Daniel Engberg
Modified: 2023-03-29 11:38 UTC (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Engberg freebsd_committer freebsd_triage 2021-06-09 19:24:46 UTC
If a port uses shebangfix on .py files without utilizing/pulling in python it'll silently fail.
Comment 1 Matthias Andree freebsd_committer freebsd_triage 2022-10-27 19:02:50 UTC
for me it failed noisily when preparing a security/openvpn-devel patch, https://cgit.freebsd.org/ports/commit/security/openvpn-devel?id=bb24536ac02a721fdc6657a2ff5e43c0c71ae54e did complain in stage-qa here with Error: '/usr/local/bin/python' is an invalid shebang you need USES=shebangfix for 'share/examples/openvpn/sample-scripts/totpauth.py'
Although it had replaced the original /usr/bin/python3 with /usr/local/bin/python (and default LOCALBASE).
Comment 2 Nuno Teixeira freebsd_committer freebsd_triage 2023-03-29 09:23:08 UTC
Same here updating print/paps with meson:

USES+= shebangfix
SHEBANG_FILES= scripts/src-to-paps

---
===>  Staging for paps-0.8.0
===>   Generating temporary packing list
[  0% 1/1] /usr/local/bin/meson install --no-rebuild
Installing src/paps to /usr/home/nunotex/Work/freebsd/ports/main/print/paps/work/stage/usr/local/bin
Stripping target 'src/paps'.
Installing /usr/home/nunotex/Work/freebsd/ports/main/print/paps/work/paps-0.8.0/src/paps.1 to /usr/home/nunotex/Work/freebsd/ports/main/print/paps/work/stage/usr/local/man/man1
Installing /usr/home/nunotex/Work/freebsd/ports/main/print/paps/work/paps-0.8.0/misc/pango_markup.outlang to /usr/home/nunotex/Work/freebsd/ports/main/print/paps/work/stage/usr/local/share/paps
Installing /usr/home/nunotex/Work/freebsd/ports/main/print/paps/work/paps-0.8.0/scripts/src-to-paps to /usr/home/nunotex/Work/freebsd/ports/main/print/paps/work/stage/usr/local/bin
====> Compressing man pages (compress-man)
====> Running Q/A tests (stage-qa)
Error: '/usr/local/bin/python' is an invalid shebang you need USES=shebangfix for 'bin/src-to-paps'
*** Error code 1
---

Any workaround?
Comment 3 Nuno Teixeira freebsd_committer freebsd_triage 2023-03-29 09:29:36 UTC
(...)

Fixed by adding python to USES.
Comment 4 Daniel Engberg freebsd_committer freebsd_triage 2023-03-29 11:38:02 UTC
The workaround is to use python:env unless the port actually depends on python