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.8.2
%global         tag         v%{version}

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

License:        BSD-3-Clause
URL:            %forgeurl
Source:         %forgesource

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}


# NOTE(mhayden): Upstream has a custom pytest.ini that requires 100% test
# coverage, but upstream does not have 100% test coverage yet.
mv pytest.ini pytest.ini_disabled



%pyproject_save_files portalocker

%if %{test_with_redis}
%pyproject_check_import -e portalocker.redis

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

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