4a175e7
# Sphinx-generated HTML documentation is not suitable for packaging; see
4a175e7
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
4a175e7
#
d4a282c
# We can generate PDF documentation as a substitute.
346082a
%bcond doc_pdf 1
4a175e7
3f76b2b
Name:           python-sure
95d0a26
Version:        2.0.1
f8dc650
Release:        %autorelease
4df669d
Summary:        Idiomatic assertion toolkit with human-friendly failure messages
5ec486c
a5cb6eb
License:        GPL-3.0-or-later
3f76b2b
URL:            https://github.com/gabrielfalcao/sure
3f76b2b
Source0:        %{url}/archive/%{version}/sure-%{version}.tar.gz
a489112
30f1554
# Trivial downstream man page for (nearly pointless) executable
3f76b2b
Source1:        sure.1
a489112
2512269
# Python 3.10 workaround
2512269
# In test_context_is_not_optional(), only check the exception type
2512269
# https://github.com/gabrielfalcao/sure/issues/169
94e17f6
Patch:          python3.10-workaround.patch
2512269
5ec486c
BuildArch:      noarch
5ec486c
90ab75a
BuildRequires:  python3-devel
7ca11cc
7ca11cc
# TODO: remove mock dependency from install_requires
7ca11cc
# https://fedoraproject.org/wiki/Changes/DeprecatePythonMock
7ca11cc
# https://github.com/gabrielfalcao/sure/pull/161
7ca11cc
7948487
# Test dependencies
30f1554
# development.txt: pytest==6.2.4
7ca11cc
BuildRequires:  python3dist(pytest)
a594c9c
4a175e7
%if %{with doc_pdf}
7948487
BuildRequires:  make
30f1554
# development.txt: Sphinx==2.3.1
7948487
BuildRequires:  python3dist(sphinx)
30f1554
# development.txt: sphinx-rtd-theme==0.4.3
7948487
BuildRequires:  python3dist(sphinx-rtd-theme)
4a175e7
BuildRequires:  python3-sphinx-latex
4a175e7
BuildRequires:  latexmk
4a175e7
%endif
7948487
4df669d
%global common_description %{expand:
4df669d
An idiomatic testing library for python with powerful and flexible assertions
4df669d
created by Gabriel Falcão. Sure’s developer experience is inspired and modeled
4df669d
after RSpec Expectations and should.js.}
4df669d
4df669d
%description %{common_description}
a13a3aa
7db239d
3f76b2b
%package -n python3-sure
4df669d
Summary:        %{summary}
a594c9c
3f76b2b
%description -n python3-sure %{common_description}
7db239d
a594c9c
84ad325
%if %{with doc_pdf}
7948487
%package doc
7948487
Summary:        Documentation for Sure
7948487
7948487
%description doc %{common_description}
84ad325
%endif
7948487
7948487
5ec486c
%prep
3f76b2b
%autosetup -p1 -n sure-%{version}
a594c9c
74ed14e
# Drop intersphinx mappings, since we can’t download remote inventories and
74ed14e
# can’t easily produce working hyperlinks from inventories in local
74ed14e
# documentation packages.
1929320
echo 'intersphinx_mapping.clear()' >> docs/source/conf.py
32ce636
39e68a7
# Do not generate a coverage report; this obviates the BR on pytest-cov
39e68a7
sed -r -i 's/[[:blank:]]--cov=[^[:blank:]]+//' setup.cfg
39e68a7
7db239d
c7cfbf0
%generate_buildrequires
cd73a95
%pyproject_buildrequires
c7cfbf0
c7cfbf0
5ec486c
%build
7ca11cc
%pyproject_wheel
4a175e7
%if %{with doc_pdf}
02a39ed
PYTHONPATH="${PWD}" %make_build -C docs latex \
02a39ed
    SPHINXOPTS='-j%{?_smp_build_ncpus}'
d4a282c
%make_build -C docs/build/latex LATEXMKOPTS='-quiet'
4a175e7
%endif
7db239d
a594c9c
5ec486c
%install
7ca11cc
%pyproject_install
91f48a8
%pyproject_save_files -l sure
7db239d
6c57b90
install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{SOURCE1}'
30f1554
a594c9c
5ec486c
%check
39e68a7
# The old_api tests use python3dist(nose), which is deprecated and which we
39e68a7
# have removed from the BuildRequires:
39e68a7
# https://fedoraproject.org/wiki/Changes/DeprecateNose
39e68a7
%pytest --ignore=tests/test_old_api.py
7db239d
a594c9c
3f76b2b
%files -n python3-sure -f %{pyproject_files}
84ad325
%if %{without doc_pdf}
84ad325
%doc CHANGELOG.md README.rst TODO.rst
84ad325
%endif
3f76b2b
%{_bindir}/sure
3f76b2b
%{_mandir}/man1/sure.1*
7948487
7948487
84ad325
%if %{with doc_pdf}
7948487
%files doc
4bc2932
%license COPYING
84ad325
%doc CHANGELOG.md README.rst TODO.rst
4a175e7
%doc docs/build/latex/Sure.pdf
4a175e7
%endif
7db239d
a594c9c
5ec486c
%changelog
f8dc650
%autochangelog