|
|
1ebe369 |
# epel macros
|
|
|
1ebe369 |
|
|
|
1ebe369 |
%epel 8
|
|
|
1ebe369 |
|
|
|
1ebe369 |
# Mono macros requested in rhbz 1295117
|
|
|
1ebe369 |
%mono_arches %{ix86} x86_64 sparc sparcv9 ia64 %{arm} alpha s390x ppc ppc64 ppc64le
|
|
|
1ebe369 |
%_monodir %{_prefix}/lib/mono
|
|
|
1ebe369 |
%_monogacdir %{_monodir}/gac
|
|
|
1ebe369 |
|
|
|
1ebe369 |
# A directory for rpm macros
|
|
|
1ebe369 |
%rpmmacrodir /usr/lib/rpm/macros.d
|
|
|
1ebe369 |
|
|
|
1ebe369 |
# Upstream RPM has this in Fedora, obsoleting the one above.
|
|
|
1ebe369 |
%_rpmmacrodir /usr/lib/rpm/macros.d
|
|
|
1ebe369 |
|
|
|
1ebe369 |
# Bash completions; not in bash to not intefere with install ordering
|
|
|
1ebe369 |
%bash_completion_dir /usr/share/bash-completion/completions/
|
|
|
1ebe369 |
|
|
|
77c53c7 |
# Use the non-underscored Python macros to refer to Python in spec, etc.
|
|
|
77c53c7 |
%python2 %__python2
|
|
|
77c53c7 |
%python3 %__python3
|
|
|
4bf0de7 |
|
|
|
054c9b6 |
# Simplified version backported from Fedora
|
|
|
054c9b6 |
%py_shebang_fix %{expand:/usr/bin/pathfix.py -pni "%{__python} %{py_shbang_opts}"}
|
|
|
054c9b6 |
%py2_shebang_fix %{expand:/usr/bin/pathfix.py -pni "%{__python2} %{py2_shbang_opts}"}
|
|
|
054c9b6 |
%py3_shebang_fix %{expand:/usr/bin/pathfix.py -pni "%{__python3} %{py3_shbang_opts}"}
|
|
|
054c9b6 |
|
|
|
f73450a |
# https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names
|
|
|
f73450a |
%python_platform_triplet %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
|
|
|
f73450a |
%python_ext_suffix %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
|
|
|
f73450a |
%python3_platform_triplet %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
|
|
|
f73450a |
%python3_ext_suffix %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
|
|
|
f73450a |
|
|
|
db76dd3 |
# Users can use %%python only if they redefined %%__python (e.g. to %%__python3)
|
|
|
db76dd3 |
%python() %{lua:\
|
|
|
db76dd3 |
__python = rpm.expand("%__python")\
|
|
|
db76dd3 |
if __python == "/usr/bin/python" then\
|
|
|
db76dd3 |
rpm.expand("%{error:Cannot use %%python if %%__python wasn't redefined to something other than /usr/bin/python.}")\
|
|
|
db76dd3 |
else\
|
|
|
db76dd3 |
print(__python)\
|
|
|
db76dd3 |
end\
|
|
|
db76dd3 |
}
|
|
|
db76dd3 |
|
|
|
64bc4a7 |
# This only supports Python 3.5+ and will never work with Python 2.
|
|
|
64bc4a7 |
# Hence, it has no Python version in the name.
|
|
|
64bc4a7 |
%pycached() %{lua:
|
|
|
07f430f |
path = rpm.expand("%{?*}")
|
|
|
64bc4a7 |
if (string.sub(path, "-3") ~= ".py") then
|
|
|
64bc4a7 |
rpm.expand("%{error:%%pycached can only be used with paths explicitly ending with .py}")
|
|
|
64bc4a7 |
else
|
|
|
64bc4a7 |
print(path)
|
|
|
64bc4a7 |
pyminor = path:match("/python3.(%d+)/") or "*"
|
|
|
64bc4a7 |
dirname = path:match("(.*/)")
|
|
|
64bc4a7 |
modulename = path:match(".*/([^/]+).py")
|
|
|
64bc4a7 |
print("\\n" .. dirname .. "__pycache__/" .. modulename .. ".cpython-3" .. pyminor .. "{,.opt-?}.pyc")
|
|
|
64bc4a7 |
end
|
|
|
64bc4a7 |
}
|
|
|
64bc4a7 |
|
|
|
054c9b6 |
# This is intended for Python 3 only, hence also no Python version in the name.
|
|
|
054c9b6 |
%__pytest /usr/bin/pytest-3
|
|
|
054c9b6 |
%pytest %{expand:\\\
|
|
|
054c9b6 |
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
|
|
|
054c9b6 |
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
|
|
054c9b6 |
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
|
|
|
054c9b6 |
PYTHONDONTWRITEBYTECODE=1\\\
|
|
|
054c9b6 |
%__pytest}
|
|
|
054c9b6 |
|
|
|
054c9b6 |
%py_provides() %{lua:
|
|
|
054c9b6 |
local name = rpm.expand('%1')
|
|
|
054c9b6 |
if name == '%1' then
|
|
|
054c9b6 |
rpm.expand('%{error:%%py_provides requires at least 1 argument, the name to provide}')
|
|
|
054c9b6 |
end
|
|
|
054c9b6 |
local evr = rpm.expand('%2')
|
|
|
054c9b6 |
if evr == '%2' then
|
|
|
054c9b6 |
evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')
|
|
|
054c9b6 |
end
|
|
|
054c9b6 |
print('Provides: ' .. name .. ' = ' .. evr .. '\\n')
|
|
|
054c9b6 |
-- NB: dash needs to be escaped!
|
|
|
054c9b6 |
if name:match('^python3%-') then
|
|
|
054c9b6 |
replaced = name:gsub('^python3%-', 'python-')
|
|
|
054c9b6 |
print('Provides: ' .. replaced .. ' = ' .. evr .. '\\n')
|
|
|
054c9b6 |
end
|
|
|
054c9b6 |
}
|
|
|
054c9b6 |
|
|
|
05b5b0a |
# With $PATH and $PYTHONPATH set to the %%buildroot,
|
|
|
05b5b0a |
# try to import the given Python module(s).
|
|
|
05b5b0a |
# Useful as a smoke test in %%check when running tests is not feasible.
|
|
|
05b5b0a |
# Use spaces or commas as separators.
|
|
|
05b5b0a |
%py_check_import() %{expand:\\\
|
|
|
05b5b0a |
(cd %{_topdir} &&\\\
|
|
|
05b5b0a |
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
|
|
05b5b0a |
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python_sitearch}:%{buildroot}%{python_sitelib}}"\\\
|
|
|
05b5b0a |
PYTHONDONTWRITEBYTECODE=1\\\
|
|
|
05b5b0a |
%{__python} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
|
|
05b5b0a |
)
|
|
|
05b5b0a |
}
|
|
|
05b5b0a |
%py2_check_import() %{expand:\\\
|
|
|
05b5b0a |
(cd %{_topdir} &&\\\
|
|
|
05b5b0a |
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
|
|
05b5b0a |
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python2_sitearch}:%{buildroot}%{python2_sitelib}}"\\\
|
|
|
05b5b0a |
PYTHONDONTWRITEBYTECODE=1\\\
|
|
|
05b5b0a |
%{__python2} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
|
|
05b5b0a |
)
|
|
|
05b5b0a |
}
|
|
|
05b5b0a |
%py3_check_import() %{expand:\\\
|
|
|
05b5b0a |
(cd %{_topdir} &&\\\
|
|
|
05b5b0a |
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
|
|
05b5b0a |
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
|
|
|
05b5b0a |
PYTHONDONTWRITEBYTECODE=1\\\
|
|
|
05b5b0a |
%{__python3} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
|
|
05b5b0a |
)
|
|
|
05b5b0a |
}
|
|
|
05b5b0a |
|
|
|
2962b79 |
%python_disable_dependency_generator() \
|
|
|
2962b79 |
%undefine __pythondist_requires \
|
|
|
2962b79 |
%{nil}
|
|
|
2962b79 |
|
|
|
4bf0de7 |
# gpgverify verifies signed sources. There is documentation in the script.
|
|
|
03f860c |
%gpgverify(k:s:d:) %{lua:
|
|
|
03f860c |
local script = rpm.expand("%{_rpmconfigdir}/gpgverify ")
|
|
|
03f860c |
local keyring = rpm.expand("%{-k*}")
|
|
|
03f860c |
local signature = rpm.expand("%{-s*}")
|
|
|
03f860c |
local data = rpm.expand("%{-d*}")
|
|
|
03f860c |
print(script)
|
|
|
03f860c |
if keyring ~= "" then
|
|
|
03f860c |
print(rpm.expand("--keyring='%{SOURCE" .. keyring .. "}' "))
|
|
|
03f860c |
end
|
|
|
03f860c |
if signature ~= "" then
|
|
|
03f860c |
print(rpm.expand("--signature='%{SOURCE" .. signature .. "}' "))
|
|
|
03f860c |
end
|
|
|
03f860c |
if data ~= "" then
|
|
|
03f860c |
print(rpm.expand("--data='%{SOURCE" .. data .. "}' "))
|
|
|
03f860c |
end
|
|
|
03f860c |
}
|
|
|
7d7c796 |
|
|
|
7d7c796 |
# qt5 macro removed from RHEL8 but needed to ensure qtwebengine, and
|
|
|
7d7c796 |
# it's dependencies build on supported arches.
|
|
|
7d7c796 |
%qt5_qtwebengine_arches %{ix86} x86_64 %{arm} aarch64 mips mipsel mips64el
|