Hardcode %{_bindir} into python-config script + remove unreachable error handling

The `dirname $0` breaks the script when it is linked to a different location,
for example the RHEL's /usr/libexec/platform-python-config.

The error handling was never reachable, failed exec ends the script.

See https://src.fedoraproject.org/rpms/python3.9/pull-request/38
This commit is contained in:
Miro Hrončok 2020-10-27 16:06:38 +00:00
parent 0995309f1a
commit 13d401b11a

View File

@ -824,9 +824,7 @@ InstallPython() {
# Rename the -devel script that differs on different arches to arch specific name
mv %{buildroot}%{_bindir}/python${LDVersion}-{,`uname -m`-}config
echo -e '#!/bin/sh\nexec `dirname $0`/python'${LDVersion}'-`uname -m`-config "$@"' > \
%{buildroot}%{_bindir}/python${LDVersion}-config
echo '[ $? -eq 127 ] && echo "Could not find python'${LDVersion}'-`uname -m`-config. Look around to see available arches." >&2' >> \
echo -e '#!/bin/sh\nexec %{_bindir}/python'${LDVersion}'-`uname -m`-config "$@"' > \
%{buildroot}%{_bindir}/python${LDVersion}-config
chmod +x %{buildroot}%{_bindir}/python${LDVersion}-config