Set %__python3 to /usr/bin/python3.6 by default

When %%python3_pkgveresion is set to 3 (i.e. the default), we override
%%__python3 to /usr/bin/python3.6 to ensure that programs are always run
with python3.6, even if /usr/bin/python3 is a symlink to a different
interpreter.

After:

```
$ rpm -E %python3
/usr/bin/python3.6
$ rpm -E %__python3
/usr/bin/python3.6
$ rpm -D 'python3_pkgversion 3.6' -E %__python3
/usr/bin/python3.6
$ rpm -D 'python3_pkgversion 3.8' -E %__python3
/usr/bin/python3.8
$ rpm -D 'python3_pkgversion 3.9' -E %__python3
/usr/bin/python3.9
$ rpm -D 'python3_pkgversion 3.11' -E %__python3
/usr/bin/python3.11
$ rpm -D 'python3_pkgversion 3.11' -E %python3
/usr/bin/python3.11
$ rpm -D 'python3_pkgversion 3.6' -E %python3
/usr/bin/python3.6
$ rpm -E %python3
/usr/bin/python3.6
```

Before:
```
$ rpm -E %python3
/usr/bin/python3
$ rpm -D 'python3_pkgversion 3.8' -E %python3
/usr/bin/python3.8
[...]
```

Relates: https://lists.fedoraproject.org/archives/list/epel-devel@lists.fedoraproject.org/thread/RE3PG72B5AX7NTACPDSBGOWCMN7I3OQJ/
epel8
Maxwell G 2 years ago
parent 5aa786f208
commit ba3cef50bb
No known key found for this signature in database
GPG Key ID: F79E4E25E8C661F8

@ -1,6 +1,6 @@
Name: epel-rpm-macros Name: epel-rpm-macros
Version: 8 Version: 8
Release: 33 Release: 34
Summary: Extra Packages for Enterprise Linux RPM macros Summary: Extra Packages for Enterprise Linux RPM macros
License: GPLv2 License: GPLv2
@ -112,6 +112,9 @@ install -Dpm 644 %{SOURCE150} \
%changelog %changelog
* Tue Nov 08 2022 Maxwell G <gotmax@e.email> - 8-34
- Set %%__python3 to /usr/bin/python3.6 by default
* Wed Aug 24 2022 Iñaki Úcar <iucar@fedoraproject.org> - 8-33 * Wed Aug 24 2022 Iñaki Úcar <iucar@fedoraproject.org> - 8-33
- Backport java_arches macro from Fedora - Backport java_arches macro from Fedora

@ -9,7 +9,23 @@
# and the default is /usr/libexec/platform-python. # and the default is /usr/libexec/platform-python.
# Usually, we don't want EPEL packages to use platform-python. # Usually, we don't want EPEL packages to use platform-python.
# Packages that want to do that can explicitly override this. # Packages that want to do that can explicitly override this.
%__python3 /usr/bin/python%{_python3_pkgversion_with_dot} #
# When %%python3_pkgveresion is set to 3 (i.e. the default), we override
# %%__python3 to /usr/bin/python3.6 to ensure that programs are always run with
# python3.6, even if /usr/bin/python3 is a symlink to a different interpreter.
#
# See https://lists.fedoraproject.org/archives/list/epel-devel@lists.fedoraproject.org/thread/RE3PG72B5AX7NTACPDSBGOWCMN7I3OQJ/
%__python3 %{lua:
local bin = "/usr/bin/python"
if rpm.expand("%python3_pkgversion") == "3" then
bin = bin .. "3.6"
else
bin = bin .. rpm.expand("%{_python3_pkgversion_with_dot}")
end
print(bin)
}
# RHEL 8's %%pytest does not work properly on non-default Python versions. # RHEL 8's %%pytest does not work properly on non-default Python versions.
# Backported from https://src.fedoraproject.org/rpms/python-rpm-macros/c/02536540768555dde6d675935db45df81bcab7bf?branch=rawhide # Backported from https://src.fedoraproject.org/rpms/python-rpm-macros/c/02536540768555dde6d675935db45df81bcab7bf?branch=rawhide

Loading…
Cancel
Save