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

@ -8,7 +8,14 @@
%py3_shbang_opts -s
%py3_shbang_opts_nodash %(opts=%{py3_shbang_opts}; echo ${opts#-})
%py3_shebang_flags %(opts=%{py3_shbang_opts}; echo ${opts#-})
%py3_shebang_fix %{expand:/usr/bin/pathfix.py -pni %{__python3} -k%{?py3_shebang_flags:a %py3_shebang_flags}}
%py3_shebang_fix %{expand:\\\
if [ -f /usr/bin/pathfix%{python3_version}.py ]; then
pathfix=/usr/bin/pathfix%{python3_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 %{__python3} -k%{?py3_shebang_flags:a %py3_shebang_flags}}
# Use the slashes after expand so that the command starts on the same line as
# the macro