python-fasteners/python-fasteners.spec
2022-05-16 10:54:19 -04:00

107 lines
2.4 KiB
RPMSpec

%bcond_without tests
# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a substitute.
%bcond_without doc_pdf
# The python-diskcache package, used in some of the tests, has been retired.
%bcond_with diskcache
Name: python-fasteners
Version: 0.17.3
Release: %autorelease
Summary: A python package that provides useful locks
License: ASL 2.0
URL: https://github.com/harlowja/fasteners
# We need to use the GitHub archive instead of the PyPI sdist to get tests.
Source0: %{url}/archive/%{version}/fasteners-%{version}.tar.gz
# “Remove futures from the requirements-test.txt”
# Backport upstream commit 49d8f5b to remove a test dependency that is no
# longer used and only supports Python 2.
Patch: %{url}/commit/49d8f5bb56157a82ff3e6128b506638a214e6d43.patch
BuildArch: noarch
BuildRequires: python3-devel
%if %{with doc_pdf}
BuildRequires: make
BuildRequires: python3dist(sphinx)
BuildRequires: python3-sphinx-latex
BuildRequires: latexmk
%endif
%global common_description %{expand: \
Cross platform locks for threads and processes}
%description
%{common_description}
%package -n python3-fasteners
Summary: A python package that provides useful locks
%description -n python3-fasteners
%{common_description}
%package doc
Summary: Documentation for fasteners
%description doc
%{common_description}
%prep
%autosetup -p1 -n fasteners-%{version}
%if %{without diskcache}
sed -r -i '/\b(diskcache)\b/d' requirements-test.txt
%endif
%generate_buildrequires
%pyproject_buildrequires %{?with_tests:requirements-test.txt}
%build
%pyproject_wheel
%if %{with doc_pdf}
PYTHONPATH="${PWD}" sphinx-build -b latex doc/source %{_vpath_builddir}/_latex
%make_build -C %{_vpath_builddir}/_latex LATEXMKOPTS='-quiet'
%endif
%install
%pyproject_install
%pyproject_save_files fasteners
%check
%if %{with tests}
%pytest %{?!with_diskcache:--ignore=tests/test_reader_writer_lock.py}
%else
%pyproject_check_import -e 'fasteners.pywin32*'
%endif
%files -n python3-fasteners -f %{pyproject_files}
# pyproject_files handles LICENSE; verify with “rpm -qL -p …”
%files doc
%license LICENSE
%doc CHANGELOG
%doc README.md
%if %{with doc_pdf}
%doc %{_vpath_builddir}/_latex/Fasteners.pdf
%endif
%changelog
%autochangelog