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
%else
%global test_with_redis 1
%endif

%global         srcname     portalocker
%global         forgeurl    https://github.com/WoLpH/portalocker
Version:        2.4.0
%global         tag         v%{version}
%forgemeta

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)
%endif
%endif

%global _description %{expand:
%{summary}}

%description %{_description}


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


%prep
%forgeautosetup


%generate_buildrequires
%pyproject_buildrequires -r


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files portalocker


%if %{with tests}
%check
%pytest %{?test_with_redis:--ignore=portalocker_tests/test_redis.py} portalocker_tests
%endif

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

%changelog
%autochangelog