Blob Blame History Raw
# tests are enabled by default
%bcond_without  tests

# python-redis is missing from EPEL 9, but many of the tests will still run without
# it being present at test time. See BZ 2063713.
%if 0%{?el9} || 0%{?centos} >= 9
%global test_with_redis 0
%global test_with_redis 1

%global         srcname     portalocker
%global         forgeurl
Version:        2.4.0
%global         tag         v%{version}

Name:           python-%{srcname}
Release:        %autorelease
Summary:        Library to provide an easy API to file locking

License:        Python
URL:            %forgeurl
Source:         %forgesource

# NOTE(mhayden): Upstream has pytest coverage enabled and it requires 100% coverage to
# pass. The only problem is that upstream doesn't have 100% test coverage yet.
Patch0:         disable-pytest-coverage.patch

BuildArch:      noarch

BuildRequires:  python3-devel

%if %{with tests}
BuildRequires:  python3dist(pygments)
BuildRequires:  python3dist(pytest)
%if 0%{?test_with_redis}
BuildRequires:  python3dist(redis)

%global _description %{expand:

%description %{_description}

%package -n python3-%{srcname}
Summary:        %{summary}
%description -n python3-%{srcname} %{_description}


%pyproject_buildrequires -r


%pyproject_save_files portalocker

%if %{with tests}
%pytest %{?test_with_redis:--ignore=portalocker_tests/} portalocker_tests

%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE
%doc README.rst