|
|
|
# epel macros
|
|
|
|
|
|
|
|
%epel 8
|
|
|
|
|
|
|
|
# Mono macros requested in rhbz 1295117
|
|
|
|
%mono_arches %{ix86} x86_64 sparc sparcv9 ia64 %{arm} alpha s390x ppc ppc64 ppc64le
|
|
|
|
%_monodir %{_prefix}/lib/mono
|
|
|
|
%_monogacdir %{_monodir}/gac
|
|
|
|
|
|
|
|
# A directory for rpm macros
|
|
|
|
%rpmmacrodir /usr/lib/rpm/macros.d
|
|
|
|
|
|
|
|
# Upstream RPM has this in Fedora, obsoleting the one above.
|
|
|
|
%_rpmmacrodir /usr/lib/rpm/macros.d
|
|
|
|
|
|
|
|
# Bash completions; not in bash to not intefere with install ordering
|
|
|
|
%bash_completion_dir /usr/share/bash-completion/completions/
|
|
|
|
|
|
|
|
# Use the non-underscored Python macros to refer to Python in spec, etc.
|
|
|
|
%python2 %__python2
|
|
|
|
%python3 %__python3
|
|
|
|
|
|
|
|
# Simplified version backported from Fedora
|
|
|
|
%py_shebang_fix %{expand:/usr/bin/pathfix.py -pni "%{__python} %{py_shbang_opts}"}
|
|
|
|
%py2_shebang_fix %{expand:/usr/bin/pathfix.py -pni "%{__python2} %{py2_shbang_opts}"}
|
|
|
|
%py3_shebang_fix %{expand:/usr/bin/pathfix.py -pni "%{__python3} %{py3_shbang_opts}"}
|
|
|
|
|
|
|
|
# https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names
|
|
|
|
%python_platform_triplet %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
|
|
|
|
%python_ext_suffix %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
|
|
|
|
%python3_platform_triplet %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
|
|
|
|
%python3_ext_suffix %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
|
|
|
|
|
|
|
|
# Users can use %%python only if they redefined %%__python (e.g. to %%__python3)
|
|
|
|
%python() %{lua:\
|
|
|
|
__python = rpm.expand("%__python")\
|
|
|
|
if __python == "/usr/bin/python" then\
|
|
|
|
rpm.expand("%{error:Cannot use %%python if %%__python wasn't redefined to something other than /usr/bin/python.}")\
|
|
|
|
else\
|
|
|
|
print(__python)\
|
|
|
|
end\
|
|
|
|
}
|
|
|
|
|
|
|
|
# This only supports Python 3.5+ and will never work with Python 2.
|
|
|
|
# Hence, it has no Python version in the name.
|
|
|
|
%pycached() %{lua:
|
|
|
|
path = rpm.expand("%{?*}")
|
|
|
|
if (string.sub(path, "-3") ~= ".py") then
|
|
|
|
rpm.expand("%{error:%%pycached can only be used with paths explicitly ending with .py}")
|
|
|
|
else
|
|
|
|
print(path)
|
|
|
|
pyminor = path:match("/python3.(%d+)/") or "*"
|
|
|
|
dirname = path:match("(.*/)")
|
|
|
|
modulename = path:match(".*/([^/]+).py")
|
|
|
|
print("\\n" .. dirname .. "__pycache__/" .. modulename .. ".cpython-3" .. pyminor .. "{,.opt-?}.pyc")
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
# This is intended for Python 3 only, hence also no Python version in the name.
|
|
|
|
%__pytest /usr/bin/pytest-3
|
|
|
|
%pytest %{expand:\\\
|
|
|
|
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
|
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
|
|
|
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
|
|
|
|
PYTHONDONTWRITEBYTECODE=1\\\
|
|
|
|
%__pytest}
|
|
|
|
|
|
|
|
%py_provides() %{lua:
|
|
|
|
local name = rpm.expand('%1')
|
|
|
|
if name == '%1' then
|
|
|
|
rpm.expand('%{error:%%py_provides requires at least 1 argument, the name to provide}')
|
|
|
|
end
|
|
|
|
local evr = rpm.expand('%2')
|
|
|
|
if evr == '%2' then
|
|
|
|
evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')
|
|
|
|
end
|
|
|
|
print('Provides: ' .. name .. ' = ' .. evr .. '\\n')
|
|
|
|
-- NB: dash needs to be escaped!
|
|
|
|
if name:match('^python3%-') then
|
|
|
|
replaced = name:gsub('^python3%-', 'python-')
|
|
|
|
print('Provides: ' .. replaced .. ' = ' .. evr .. '\\n')
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
# With $PATH and $PYTHONPATH set to the %%buildroot,
|
|
|
|
# try to import the given Python module(s).
|
|
|
|
# Useful as a smoke test in %%check when running tests is not feasible.
|
|
|
|
# Use spaces or commas as separators.
|
|
|
|
%py_check_import(e:tf:) %{expand:\\\
|
|
|
|
%{-e:echo 'WARNING: The -e option of %%%%py_check_import is not currently supported on EPEL.' >&2}
|
|
|
|
%{-t:echo 'WARNING: The -t option of %%%%py_check_import is not currently supported on EPEL.' >&2}
|
|
|
|
%{-f:echo 'WARNING: The -f option of %%%%py_check_import is not currently supported on EPEL.' >&2}
|
|
|
|
(cd %{_topdir} &&\\\
|
|
|
|
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
|
|
|
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python_sitearch}:%{buildroot}%{python_sitelib}}"\\\
|
|
|
|
PYTHONDONTWRITEBYTECODE=1\\\
|
|
|
|
%{__python} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
%py2_check_import(e:tf:) %{expand:\\\
|
|
|
|
%{-e:echo 'WARNING: The -e option of %%%%py2_check_import is not currently supported on EPEL.' >&2}
|
|
|
|
%{-t:echo 'WARNING: The -t option of %%%%py2_check_import is not currently supported on EPEL.' >&2}
|
|
|
|
%{-f:echo 'WARNING: The -f option of %%%%py2_check_import is not currently supported on EPEL.' >&2}
|
|
|
|
(cd %{_topdir} &&\\\
|
|
|
|
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
|
|
|
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python2_sitearch}:%{buildroot}%{python2_sitelib}}"\\\
|
|
|
|
PYTHONDONTWRITEBYTECODE=1\\\
|
|
|
|
%{__python2} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
%py3_check_import(e:tf:) %{expand:\\\
|
|
|
|
%{-e:echo 'WARNING: The -e option of %%%%py3_check_import is not currently supported on EPEL.' >&2}
|
|
|
|
%{-t:echo 'WARNING: The -t option of %%%%py3_check_import is not currently supported on EPEL.' >&2}
|
|
|
|
%{-f:echo 'WARNING: The -f option of %%%%py3_check_import is not currently supported on EPEL.' >&2}
|
|
|
|
(cd %{_topdir} &&\\\
|
|
|
|
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
|
|
|
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
|
|
|
|
PYTHONDONTWRITEBYTECODE=1\\\
|
|
|
|
%{__python3} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
%python_disable_dependency_generator() \
|
|
|
|
%undefine __pythondist_requires \
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
# Define where Python wheels will be stored and the prefix of -wheel packages
|
|
|
|
# - In Fedora we want wheel subpackages named e.g. `python-pip-wheel` that
|
|
|
|
# install packages into `/usr/share/python-wheels`. Both names are not
|
|
|
|
# versioned, because they're used by all Python 3 stacks.
|
|
|
|
# - In RHEL we want wheel packages named e.g. `python3-pip-wheel` and
|
|
|
|
# `python3.11-pip-wheel` that install packages into similarly versioned
|
|
|
|
# locations. We want each Python stack in RHEL to have their own wheels,
|
|
|
|
# because the main python3 wheels (which we can't upgrade) will likely be
|
|
|
|
# quite old by the time we're adding new alternate Python stacks.
|
|
|
|
# - In ELN we want to follow Fedora, because builds for ELN and Fedora rawhide
|
|
|
|
# need to be interoperable.
|
|
|
|
%python_wheel_pkg_prefix python%{?rhel:%{!?eln:%{python3_pkgversion}}}
|
|
|
|
%python_wheel_dir %{_datadir}/%{python_wheel_pkg_prefix}-wheels
|
|
|
|
|
|
|
|
# gpgverify verifies signed sources. There is documentation in the script.
|
|
|
|
%gpgverify(k:s:d:) %{lua:
|
|
|
|
local script = rpm.expand("%{_rpmconfigdir}/gpgverify ")
|
|
|
|
local keyring = rpm.expand("%{-k*}")
|
|
|
|
local signature = rpm.expand("%{-s*}")
|
|
|
|
local data = rpm.expand("%{-d*}")
|
|
|
|
print(script)
|
|
|
|
if keyring ~= "" then
|
|
|
|
print(rpm.expand("--keyring='%{SOURCE" .. keyring .. "}' "))
|
|
|
|
end
|
|
|
|
if signature ~= "" then
|
|
|
|
print(rpm.expand("--signature='%{SOURCE" .. signature .. "}' "))
|
|
|
|
end
|
|
|
|
if data ~= "" then
|
|
|
|
print(rpm.expand("--data='%{SOURCE" .. data .. "}' "))
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
# qt5 macro removed from RHEL8 but needed to ensure qtwebengine, and
|
|
|
|
# it's dependencies build on supported arches.
|
|
|
|
%qt5_qtwebengine_arches %{ix86} x86_64 %{arm} aarch64 mips mipsel mips64el
|