Re: What way of opting out form a particular Python shebang flag do you prefer?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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#comment-109228

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

--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
_______________________________________________
packaging mailing list -- packaging@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to packaging-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/packaging@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux