Blob Blame History Raw
%global pypi_name fasteners

%bcond_without tests
# The python-diskcache package, used in some of the tests, has been retired.
%bcond_with diskcache

Name:           python-%{pypi_name}
Version:        0.17
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
BuildRequires:  python3dist(setuptools)

%if %{with tests}
# requirements-test.txt
%if %{with diskcache}
BuildRequires:  python3dist(diskcache)
%endif
BuildRequires:  python3dist(more-itertools)
BuildRequires:  python3dist(pytest)
%endif

%global common_description %{expand: \
Cross platform locks for threads and processes}

%description
%{common_description}


%package -n python3-%{pypi_name}
Summary:        A python package that provides useful locks

%description -n python3-%{pypi_name}
%{common_description}


%prep
%autosetup -p1 -n %{pypi_name}-%{version}


%build
%py3_build


%install
%py3_install


%check
%if %{with tests}
%pytest %{?!with_diskcache:--ignore=tests/test_reader_writer_lock.py}
%endif


%files -n python3-%{pypi_name}
%license LICENSE
%doc ChangeLog
%doc README.md

%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/


%changelog
%autochangelog