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
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
4bf0de7
# gpgverify verifies signed sources. There is documentation in the script.
4bf0de7
%gpgverify %{_rpmconfigdir}/gpgverify
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