583ee25
# Sphinx-generated HTML documentation is not suitable for packaging; see
583ee25
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
583ee25
#
583ee25
# We can generate PDF documentation as a substitute.
9db3c27
%bcond docs 1
9ef5a7d
bc5505b
Name:           python-wrapt
5599bca
Version:        1.16.0
c773833
Release:        %autorelease
688bbdd
Summary:        A Python module for decorators, wrappers and monkey patching
688bbdd
41f3ccf
License:        BSD-2-Clause
688bbdd
URL:            https://github.com/GrahamDumpleton/wrapt
87add96
Source:         %{url}/archive/%{version}/wrapt-%{version}.tar.gz
688bbdd
dbfde20
BuildRequires:  gcc
688bbdd
9ef5a7d
BuildRequires:  python3-devel
1e695e2
1e695e2
# We bypass tox and instead BR and use pytest directly; this is simpler and
1e695e2
# avoids the need to patch out coverage analysis
1e695e2
# (https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters).
1e695e2
BuildRequires:  %{py3_dist pytest}
9ef5a7d
c0e2366
%global _description %{expand:
4e848e7
The aim of the wrapt module is to provide a transparent object proxy for
4e848e7
Python, which can be used as the basis for the construction of function
4e848e7
wrappers and decorator functions.}
688bbdd
59bc576
%description %_description
59bc576
4e848e7
%package -n python3-wrapt
4e848e7
Summary:        %{summary}
4e848e7
4e848e7
%description -n python3-wrapt %_description
4e848e7
9db3c27
%if %{with docs}
688bbdd
%package doc
688bbdd
Summary:        Documentation for the wrapt module
688bbdd
a369c24
BuildArch:      noarch
a369c24
583ee25
BuildRequires:  make
583ee25
BuildRequires:  python3-sphinx-latex
583ee25
BuildRequires:  latexmk
b9d2b86
# docs/requirements.txt
b9d2b86
BuildRequires:  %{py3_dist sphinx}
b9d2b86
BuildRequires:  %{py3_dist sphinx_rtd_theme}
688bbdd
688bbdd
%description doc
4e848e7
%{summary}.
a9fa12e
%endif
688bbdd
688bbdd
%prep
1e695e2
%autosetup -n wrapt-%{version}
688bbdd
1e695e2
%generate_buildrequires
1e695e2
%pyproject_buildrequires
9ef5a7d
688bbdd
%build
1e695e2
%pyproject_wheel
9ef5a7d
9db3c27
%if %{with docs}
583ee25
PYTHONPATH="${PWD}" %make_build -C docs latex \
583ee25
    SPHINXOPTS='-j%{?_smp_build_ncpus}'
583ee25
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
a9fa12e
%endif
688bbdd
688bbdd
%install
1e695e2
%pyproject_install
1e695e2
%pyproject_save_files -l wrapt
1e695e2
1e695e2
%check
1e695e2
%pytest -v
688bbdd
9db3c27
%if %{with docs}
688bbdd
%files doc
f00aa0d
%license LICENSE
583ee25
%doc docs/_build/latex/wrapt.pdf
a9fa12e
%endif
688bbdd
1e695e2
%files -n python3-wrapt -f %{pyproject_files}
9461ea7
%doc README.rst
9ef5a7d
688bbdd
%changelog
c773833
%autochangelog