Blob Blame History Raw
# This file is used _only_ to override macros which exist in RHEL.
# It should be used very sparingly.

# Override %__python3 here based on %%python3_pkgversion to avoid relying on the finicky
# python3X-rpm-macros packages.
# Backported from https://src.fedoraproject.org/rpms/python-rpm-macros/c/a8b26546eb699afe0dbfcef913a2aa7085fc5afb?branch=rawhide
#
# EPEL specific, RHEL defines this in the python3X-rpm-macros packages
# and the default is /usr/libexec/platform-python.
# Usually, we don't want EPEL packages to use platform-python.
# Packages that want to do that can explicitly override this.
#
# 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)
}