## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    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

Name:           python-absl-py
Version:        1.4.0
Release:        %autorelease
Summary:        Abseil Python Common Libraries

License:        Apache-2.0
URL:            https://github.com/abseil/abseil-py/
Source0:        %{url}/archive/v%{version}/abseil-py-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python3-devel

%global common_description %{expand:
This repository is a collection of Python library code for building Python
applications. The code is collected from Google’s own Python code base, and has
been extensively tested and used in production.

Features:

  • Simple application startup
  • Distributed commandline flags system
  • Custom logging module with additional features
  • Testing utilities}

%description %{common_description}


%package -n     python3-absl-py
Summary:        %{summary}

%py_provides python3-absl

%description -n python3-absl-py %{common_description}


%prep
%autosetup -n abseil-py-%{version}


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files absl


%check
# Since we cannot run the full upstream test suite (see comments below), we
# start with an import “smoke test”:
%pyproject_check_import

# Upstream provides some “smoke tests” that we can run, too. We cannot use the
# wrapper smoke_tests/smoke_test.sh because it downloads things from the
# Internet, but we can run the Python scripts manually.
PYTHONPATH='%{buildroot}/%{python3_sitelib}'; export PYTHONPATH
%{python3} smoke_tests/sample_app.py --echo smoke 2>&1 |
  grep -F 'echo is smoke.'
%{python3} smoke_tests/sample_test.py | grep -Fq 'msg_for_test'

# Running the actual test suite requires bazel, which will almost certainly
# never be packaged for Fedora due to its Byzantine mass of bundled
# dependencies. It is possible to invoke the tests with another runner, such as
# pytest, but there are many spurious failures due to the incorrect
# environment, so it is useless to do so.


%files -n python3-absl-py -f %{pyproject_files}
%doc AUTHORS
%doc CHANGELOG.md
%doc CONTRIBUTING.md
%doc README.md
%doc smoke_tests


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

* Fri Jan 13 2023 Benjamin A. Beasley <code@musicinmybrain.net> 1.4.0-1
- Update to 1.4.0 (close RHBZ#2160521)

* Fri Oct 14 2022 Benjamin A. Beasley <code@musicinmybrain.net> 1.3.0-1
- Update to 1.3.0 (close RHBZ#2134898)

* Fri Oct 14 2022 Benjamin A. Beasley <code@musicinmybrain.net> 1.2.0-2
- Update License to SPDX

* Wed Jul 20 2022 Benjamin A. Beasley <code@musicinmybrain.net> 1.2.0-1
- Update to 1.2.0 (close RHBZ#2108389)

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

* Thu Jun 02 2022 Benjamin A. Beasley <code@musicinmybrain.net> 1.1.0-1
- Update to 1.1.0 (close RHBZ#2092688)

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

* Thu Nov 11 2021 Benjamin A. Beasley <code@musicinmybrain.net> 1.0.0-1
- Update to 1.0.0 (close RHBZ#2022222)
- Change License from “ASL 2.0 and Python” to “ASL 2.0” since upstream
  dropped the Python-licensed unittest3_backport code
- Add an additional import smoke test

* Mon Oct 25 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.15.0-2
- Use %%%%python3 macro instead of %%%%__python3

* Tue Oct 19 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.15.0-1
- Update to 0.15.0; add Provides for python3-absl

* Sat Oct 02 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.14.1-1
- Update to 0.14.1 (close RHBZ#2009920)

* Wed Sep 22 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.14.0-1
- Update to 0.14.0 (close RHBZ#2006634)

* Mon Sep 13 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.13.0-7
- Let pyproject-rpm-macros handle the license file

* Sun Sep 12 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.13.0-6
- Drop BR on pyproject-rpm-macros, now implied by python3-devel

* Wed Sep 08 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.13.0-5
- Reduce spec file macro indirection

* Tue Jul 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.13.0-4
- Move %%generate_buildrequires after %%prep to make the spec file easier
  to follow

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

* Tue Jun 15 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.13.0-1
- Update to 0.13.0; closes RHBZ#1972146

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

* Tue Mar 30 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.12.0-4
- Use pyproject-rpm-macros for build and install, too

* Tue Mar 16 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.12.0-3
- Drop python3dist(setuptools) BR, redundant with %%pyproject_buildrequires

* Wed Mar 10 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.12.0-2
- Add CHANGELOG.md, from absl/, to documentation

* Wed Mar 10 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.12.0-1
- Update to 0.12.0
- Drop python-absl-py-0.11.0-python-3.10.patch, now upstreamed

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

* Fri Dec 11 2020 Benjamin A. Beasley <code@musicinmybrain.net> - 1.1.0-4
- Fix Python 3.10 incompatibility due to incorrect string-based version
  detection (RHBZ#1906811, https://github.com/abseil/abseil-py/issues/161)

* Tue Dec  1 2020 Benjamin A. Beasley <code@musicinmybrain.net> - 1.1.0-3
- Remove conditionals for Fedora 32 and older

* Wed Nov 25 2020 Benjamin A. Beasley <code@musicinmybrain.net> - 1.1.0-2
- Remove EPEL conditionals from Fedora spec file

* Wed Nov 25 2020 Benjamin A. Beasley <code@musicinmybrain.net> - 1.1.0-1
- Initial package