Jun 30, 2022 5:13:21 AM Miro Hrončok <mhroncok(a)redhat.com>:
Basically, packagers would do something like this:
# Unset -s on python shebang - ensure that extensions installed with pip
# to user locations are seen and properly loaded
%global _python3_shebang_nousersite %{nil}
Or:
# Don't add -P to Python shebang
# This package only works when /usr/bin is in sys.path
%global _python3_shebang_safepath %{nil}
The macro names are not set in stone, it could even be %_python3_shebang_s and
%_python3_shebang_P.
The previous sed-based way would still work and packages that already use it would not
need to change immediately.
Do you consider the macro based approach better (worth it)? And if so, do you prefer
actual flag letters in the macro names, or the verbose names?
Of course, I think
this is worth doing this as the person who suggested it :p. I prefer the flag letter
names. They're shorter and easier to remember (after you first learn about them).
Packagers will probably have to look up how to disable these flags when necessary and thus
read the docs about what they actually do, anyways.
I also find the double negative `%global _python3_shebang_nousersite %{nil}` confusing. If
we really want to use the verbose names (I don't), I would at least name the macro in
terms of it limiting imports to only the system site-packages instead of the other way
around. Something like `%_python3_shebang_sys_site_only` would be clearer, but it's a
bit long for my taste.
I haven't followed it closely, but there is a Change proposal to do something similar
for compiler flags in redhat-rpm-config. It might be worth alligning with that in terms of
macro naming.
--
Thanks,
Maxwell G (@gotmax23)
Pronouns: He/Him/His