Adapt %py(3)_shebang_fix to use versioned pathfixX.Y.py

Versioned pathfixX.Y.py is available in main as well as in
alternative Pythons so this change enables to build
an alternative Python stack without a dependency on the main
python3-devel.
This commit is contained in:
Lumir Balhar 2020-07-24 07:50:20 +02:00
commit 1979a78de9
4 changed files with 28 additions and 11 deletions

View file

@ -10,7 +10,14 @@
%py_shbang_opts -s
%py_shbang_opts_nodash %(opts=%{py_shbang_opts}; echo ${opts#-})
%py_shebang_flags %(opts=%{py_shbang_opts}; echo ${opts#-})
%py_shebang_fix %{expand:/usr/bin/pathfix.py -pni %{__python} -k%{?py_shebang_flags:a %py_shebang_flags}}
%py_shebang_fix %{expand:\\\
if [ -f /usr/bin/pathfix%{python_version}.py ]; then
pathfix=/usr/bin/pathfix%{python_version}.py
else
# older versions of Python don't have it and must BR /usr/bin/pathfix.py from python3-devel explicitly
pathfix=/usr/bin/pathfix.py
fi
$pathfix -pni %{__python} -k%{?py_shebang_flags:a %py_shebang_flags}}
# Use the slashes after expand so that the command starts on the same line as
# the macro