python-sure/python-sure.spec

121 lines
2.9 KiB
RPMSpec
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

%global srcname sure
Name: python-%{srcname}
Version: 2.0.0
Release: %autorelease
Summary: Idiomatic assertion toolkit with human-friendly failure messages
License: GPLv3+
URL: https://github.com/gabrielfalcao/%{srcname}
Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz
# Trivial downstream man page for (nearly pointless) executable
Source1: %{srcname}.1
# Python 3.10 workaround
# In test_context_is_not_optional(), only check the exception type
# https://github.com/gabrielfalcao/sure/issues/169
Patch0: python3.10-workaround.patch
BuildArch: noarch
BuildRequires: python3-devel
# TODO: remove mock dependency from install_requires
# https://fedoraproject.org/wiki/Changes/DeprecatePythonMock
# https://github.com/gabrielfalcao/sure/pull/161
# Test dependencies
# TODO: remove the test dependency on nose
# https://fedoraproject.org/wiki/Changes/DeprecateNose
BuildRequires: python3dist(nose)
# development.txt: pytest==6.2.4
BuildRequires: python3dist(pytest)
# development.txt: pytest-cov==2.12.1
# (We dont need coverage reports, but it is easier to add the dependency than
# to patch setup.cfg.)
BuildRequires: python3dist(pytest-cov)
# Documentation dependencies
BuildRequires: make
# development.txt: Sphinx==2.3.1
BuildRequires: python3dist(sphinx)
# development.txt: sphinx-rtd-theme==0.4.3
BuildRequires: python3dist(sphinx-rtd-theme)
BuildRequires: python3-docs
%global common_description %{expand:
An idiomatic testing library for python with powerful and flexible assertions
created by Gabriel Falcão. Sures developer experience is inspired and modeled
after RSpec Expectations and should.js.}
%description %{common_description}
%package -n python3-%{srcname}
Summary: %{summary}
%description -n python3-%{srcname} %{common_description}
%package doc
Summary: Documentation for Sure
Requires: python3-docs
%description doc %{common_description}
%prep
%autosetup -p1 -n %{srcname}-%{version}
# Use local inventories in intersphinx mappings.
#
# Currently, python-redis does not package the Sphinx documentation, so we
# remove that mapping:
# 'redis': ('https://redis-py.readthedocs.io/en/latest/', None)
sed -r -i \
-e 's|https://docs.python.org/3?|/%{_docdir}/python3-docs/html|' \
-e '/redis.*https.*readthedocs/d' \
docs/source/conf.py
cp -p '%{SOURCE1}' .
%generate_buildrequires
%pyproject_buildrequires -r
%build
%pyproject_wheel
env PYTHONPATH="${PWD}" %make_build -C docs/ html SPHINXOPTS='%{?_smp_mflags}'
rm -vf docs/_build/html/.buildinfo
%install
%pyproject_install
%pyproject_save_files %{srcname}
install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 %{srcname}.1
%check
%pytest
%files -n python3-%{srcname} -f %{pyproject_files}
%{_bindir}/%{srcname}
%{_mandir}/man1/%{srcname}.1*
%files doc
%license COPYING
%doc CHANGELOG.md
%doc README.rst
%doc TODO.rst
%doc docs/build/html
%changelog
%autochangelog