On 30. 06. 22 12:12, Miro Hrončok wrote:
Hello Pythonistas, packagers.
In the context of this change: https://fedoraproject.org/wiki/Changes/PythonSafePath
Python shebangs will have be: #! /usr/bin/python3 -sP
In order to remove certain flags, packagers have the following tool:
# Unset -s on python shebang - ensure that extensions installed with pip # to user locations are seen and properly loaded %global py3_shebang_flags %(echo %py3_shebang_flags | sed s/s//)
Or:
# Don't add -P to Python shebang # This package only works when /usr/bin is in sys.path %global py3_shebang_flags %(echo %py3_shebang_flags | sed s/P//)
In the implementation PR, Maxwell suggested a different approach: https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/141#commen...
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?
The macro-based approach has landed in rawhide. See https://fedoraproject.org/wiki/Changes/PythonSafePath#Opting_out