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 17:04:17 +01:00
parent 9ceb5be63d
commit 9d28b2b829

View File

@ -901,9 +901,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