New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] option to skip 03-rewrite-python-shebang #34053
Conversation
My position here is that sage shouldn't be merged into void as long as it's using built-in python. Most of the hooks exist for good reason, and I don't think this change has enough value. A variable to skip specific hooks is also fragile: sometimes we need to change the order they run at, and that means changing their name. |
Will this be necessary after https://trac.sagemath.org/ticket/30766 is completed? |
I agree we should use system Python, but it's targetted for Sage 9.5. |
Fair enough, I tend to think the same. Hopefully it will work with python 3.10 by the time they release sagemath-9.5. If it doesn't, though, it may mean another 6 months wait for sagemath-9.6.
Doesn't scanning and replacing all python shebangs cause issues in any other situations? In this case we are mostly replacing "#! /usr/bin/env python3" or worse "#! /usr/bin/env sage-python" (which complains about lack of python version and aborts). In particular this is NOT about hardcoding paths to the python interpreter but allowing it to run through env. It might be argued that rewriting "#! /usr/bin/env sage-python" is incorrect. Also: for packages with lots of files (and/or huge text files?) this hook takes its time... AFAICT it's not only checking in /usr/bin or +x files but every single non-binary file is scanned. A similar situation is 11-pkglint-elf-in-usrshare, but for that case we have "ignore_elf_dirs=". Example package pari-galpol contains 14681 files and using
That's a good point. It could be made different, e.g. Would one of the following be acceptable: |
There used to be a bug with replacing it without taking into account the flags passed to the interpreter in the shebang, but that's been fixed.
That is the exact purpose of the hook. It means system packages aren't affected by alternative
How does this break? Where is
Yup, there are packages with scripts under
I can kinda see the case for that, since it isn't one of the two "official" python interpreters.
I don't think this is a valid option. |
@ericonr thanks for your detailed answer. Let me add a few things:
I think we can close this PR for now and I'll probably drop the commit from the sagemath branch as well. If / when we discover issues with some of the rewritten shebangs, we can try to find workarounds. |
For #34030 we need to disable
pre-pkg/03-rewrite-python-shebang
, since sagemath ships its own python and rewriting shebangs breaks it (we will work on un-vendoring python, but that's a different story).This PR adds an option
no_python_shebang=yes
to skip running this hook, similar tonocross=yes
.If this goes through, it will have to be added to
Manual.md
and toxlint
, but I want to get feedback before.Maybe, as an alternative, a way to skip hooks by name would be more generally useful? Something like
skip_hook="pre-pkg/03-rewrite-python-shebang"
with a space separated list of hooks to skip. That shouldn't be too hard to implement inrun_pkg_hooks()
.