Skip to content

Conversation

@haampie
Copy link

@haampie haampie commented Dec 2, 2024

python may not exist, or could be the python 2 interpreter.

same should happen for tests.

Feel free to take over this PR, I just noticed this in passing.

@coveralls
Copy link

coveralls commented Dec 5, 2024

Coverage Status

coverage: 89.046%. remained the same
when pulling 20cb267 on haampie:patch-2
into 2bc7189 on seccomp:main.

@pcmoore pcmoore added the bug label Dec 18, 2024
@pcmoore pcmoore changed the title setup.py: /usr/bin/env python3 BUG: use /usr/bin/env python3 in setup.py Dec 18, 2024
@pcmoore
Copy link
Member

pcmoore commented Oct 8, 2025

Considering that Python v2 is long past it's EOL date, I'm wondering how much of an issue this is in practice, and would moving from "python" to "python3" end up creating more problems? Is there a Python requirement that systems have a working "python3" binary/link in addition to just "python"?

@haampie
Copy link
Author

haampie commented Oct 8, 2025

Python 3 itself installs python3 as an executable on unix systems, it does not install python.

For example on Ubuntu/Debian, python requires another package: https://packages.debian.org/sid/python-is-python3.

@pcmoore
Copy link
Member

pcmoore commented Oct 8, 2025

For example on Ubuntu/Debian, python requires another package: https://packages.debian.org/sid/python-is-python3.

It seems to be distro dependent. On my Arch system it appears the "python" package supplies both python and python3 whereas on Fedora (and presumably all Fedora/RHEL variants), python is supplied by the "python-unversioned-command".

It seems like there should be a PEP, or something similar, that defines a best practices for Python scripts. Digging a bit it seems like PEP-394 is relevant (see the "For Python runtime distributors" section).

Anyway, this looks fine to me and seems to be in keeping with the official Python guidance.

Acked-by: Paul Moore <paul@paul-moore.com>

@pcmoore
Copy link
Member

pcmoore commented Oct 8, 2025

Anyway, this looks fine to me and seems to be in keeping with the official Python guidance.

Acked-by: Paul Moore <paul@paul-moore.com>

Ooops, one more thing @haampie, could you provide a sign-off line in your commit?

Only the python3 executable is guaranteed

Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
@haampie haampie changed the title BUG: use /usr/bin/env python3 in setup.py BUG: use /usr/bin/env python3 Oct 9, 2025
@haampie
Copy link
Author

haampie commented Oct 9, 2025

done, also updated the other shebangs

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env/python3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be #!/usr/bin/env python3 instead? I see a few others with similar problems.

If it helps, I expect one could write a fairly minimal sed script to automate the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants