From 92066e2bc3b67f622b528ca643540cb3269fd93e Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Mar 22 2022 10:56:14 +0000 Subject: Python: Don't suggest emptying or undefining %py3_shebang_flags --- diff --git a/guidelines/modules/ROOT/pages/Python.adoc b/guidelines/modules/ROOT/pages/Python.adoc index aa08e23..84cc41b 100644 --- a/guidelines/modules/ROOT/pages/Python.adoc +++ b/guidelines/modules/ROOT/pages/Python.adoc @@ -865,8 +865,8 @@ Shebang lines to invoke Python *MUST* use `+%{python3}+` as the interpreter. Shebang lines to invoke Python *SHOULD* be `+#!%{python3} -%{py3_shebang_flags}+` and they *MAY* include extra flags. -If the default flags from <> -are not desirable, +If (some of) the default flags from +<> are not desirable, packages *SHOULD* explicitly redefine the macro to remove them. Using `+#!%{python3}+` (`+#!/usr/bin/python3+`) @@ -881,10 +881,19 @@ That ensures the user’s Python packages or just placed in the current directory) don’t interfere with the RPM installed software. Sometimes, such content is desirable, such as with plugins. -Undefining <> -or redefining it to a set of flags without `+s+`, +Redefining <> +to a set of flags without `+s+`, rather than not using the macro at all, ensures that existing or future automation won’t add the flag. +The default set of flags might be extended in the future, +hence only explicitly removing the undesired flags is more future-proof than emptying the macro: + +[source,spec] +---- +# Remove -s from 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//) +---- The <> automatically changes all Python shebangs diff --git a/guidelines/modules/ROOT/pages/Python_201x.adoc b/guidelines/modules/ROOT/pages/Python_201x.adoc index 4969164..88b6c12 100644 --- a/guidelines/modules/ROOT/pages/Python_201x.adoc +++ b/guidelines/modules/ROOT/pages/Python_201x.adoc @@ -407,7 +407,7 @@ The following macros are defined for you in all supported Fedora and EPEL releas |`+%{py3_shebang_flags}+` |`s` -|The default set of flags for Python shebangs. Redefine or undefine this to change the set. Used by `+%py3_shebang_fix+`. +|The default set of flags for Python shebangs. Redefine this to change the set. Used by `+%py3_shebang_fix+`. |`+%py3_shebang_fix …+` |(Python script)