## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 4;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

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

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

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

%description %{_description}


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


%prep
%forgeautosetup

# 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


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files portalocker


%check
%if %{test_with_redis}
%pyproject_check_import
%else
%pyproject_check_import -e portalocker.redis
%endif

%if %{with tests}
%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
## START: Generated by rpmautospec
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Tue Sep 19 2023 Major Hayden <major@redhat.com> - 2.8.2-2
- Add packit config

* Tue Sep 19 2023 Major Hayden <major@redhat.com> - 2.8.2-1
- Update to 2.8.2

* Wed Jul 26 2023 Major Hayden <major@redhat.com> - 2.7.0-5
- Fix license, skip import check on redis for EL9

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Sat Jul 01 2023 Python Maint <python-maint@redhat.com> - 2.7.0-3
- Rebuilt for Python 3.12

* Mon May 08 2023 Major Hayden <major@redhat.com> - 2.7.0-2
- Migrated to SPDX license

* Fri Feb 10 2023 Major Hayden <major@redhat.com> - 2.7.0-1
- Update to 2.7.0 rhbz#2162150

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Tue Oct 18 2022 Major Hayden <major@redhat.com> - 2.6.0-1
- Update to 2.6.0 rhbz#2135868

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jul 11 2022 Major Hayden <major@redhat.com> - 2.5.1-1
- Update to 2.5.1 rhbz#2105656

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 2.4.0-3
- Rebuilt for Python 3.11

* Wed Apr 27 2022 Major Hayden <major@mhtx.net> - 2.4.0-2
- Skip testing with redis on EPEL 9

* Thu Feb 17 2022 Major Hayden <major@redhat.com> - 2.4.0-1
- Update to 2.4.0

* Mon Feb 14 2022 Major Hayden <major@redhat.com> - 2.3.2-1
- Update to 2.3.2 and run tests

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.5.0-8
- Rebuilt for Python 3.10

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue May 26 2020 Miro Hrončok <miro@hroncok.cz> - 1.5.0-5
- Rebuilt for Python 3.9

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Oct 03 2019 Miro Hrončok <miro@hroncok.cz> - 1.5.0-3
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hrončok <miro@hroncok.cz> - 1.5.0-2
- Rebuilt for Python 3.8

* Sun Aug 04 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.5.0-1
- Update to 1.5.0

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Wed Jan 02 2019 Miro Hrončok <miro@hroncok.cz> - 1.2.1-5
- Subpackage python2-portalocker has been removed

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Sat Jul 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.2.1-3
- fix license file

* Sat Jul 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.2.1-2
- disable tests

* Sat Jul 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.2.1-1
- Update to 1.2.1

* Tue Jun 19 2018 Miro Hrončok <miro@hroncok.cz> - 1.0.1-7
- Rebuilt for Python 3.7

* Mon Mar 26 2018 Iryna Shcherbina <shcherbina.iryna@gmail.com> - 1.0.1-6
- Update Python 2 dependency declarations to new packaging standards

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Wed Jan 18 2017 Igor Gnatenko <ignatenko@redhat.com> - 1.0.1-2
- add missing BR: pytest-runner

* Wed Jan 18 2017 Igor Gnatenko <ignatenko@redhat.com> - 1.0.1-1
- Update to 1.0.1

* Mon Dec 19 2016 Miro Hrončok <miro@hroncok.cz> - 0.6.1-2
- Rebuild for Python 3.6

* Tue Sep 06 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.6.1-1
- Update to 0.6.1

* Tue Jul 19 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.6-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_
  Packages

* Tue Jun 21 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.5.6-1
- Initial import
## END: Generated by rpmautospec