You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
epel-rpm-macros/SOURCES/macros.epel-rpm-macros

110 lines
5.0 KiB

# 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
# Bash completions; not in bash to not intefere with install ordering
#
# NOTE: This macro is deprecated; point to the preferred macro from
# macros.shell-completions
%bash_completion_dir %{bash_completions_dir}
# Use the non-underscored Python macros to refer to Python in spec, etc.
%python2 %__python2
# 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\
}
# 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)}"
)
}
# With $PATH and $PYTHONPATH set to the %%buildroot,
# try to import the Python 3 module(s) given as command-line args or read from file (-f).
# Respect the custom values of %%py3_shebang_flags or set nothing if it's undefined.
# Filter and check import on only top-level modules using -t flag.
# Exclude unwanted modules by passing their globs to -e option.
# Useful as a smoke test in %%check when running tests is not feasible.
# Use spaces or commas as separators if providing list directly.
# Use newlines as separators if providing list in a file.
%py3_check_import(e:tf:) %{expand:\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
_PYTHONSITE="%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%{lua:
local command = "%{__python3} "
if rpm.expand("%{?py3_shebang_flags}") ~= "" then
command = command .. "-%{py3_shebang_flags}"
end
command = command .. " %{_rpmconfigdir}/redhat/import_all_modules.py "
-- handle multiline arguments correctly, see https://bugzilla.redhat.com/2018809
local args=rpm.expand('%{?**}'):gsub("[%s\\\\]*%s+", " ")
print(command .. args)
}
}
# When packagers go against the Packaging Guidelines and disable the runtime
# dependency generator, we want it to fall back to only creating the python(abi)
# Requires instead of none at all.
#
# This macro is EPEL 8 only, as the pythondist dependency generator
# is already disabled by the default in RHEL.
%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
# qt5 macro removed from RHEL8 but needed to ensure qtwebengine, and
# its dependencies build on supported arches.
%qt5_qtwebengine_arches %{ix86} x86_64 %{arm} aarch64 mips mipsel mips64el
# Arches that OpenJDK and dependent packages run on
%java_arches aarch64 ppc64le s390x x86_64