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

# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a substitute.
%bcond doc_pdf 1

Name:           python-pynamodb
Summary:        A pythonic interface to Amazon’s DynamoDB
Version:        6.0.1
Release:        %autorelease

# SPDX
License:        MIT
URL:            https://github.com/pynamodb/PynamoDB
# We use the GitHub tarball instead of the PyPI tarball to get documentation
# and tests.
Source:         %{url}/archive/%{version}/PynamoDB-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python3-devel

%if %{with doc_pdf}
BuildRequires:  make
BuildRequires:  python3-sphinx-latex
BuildRequires:  latexmk
%endif

%global common_description %{expand:
%{summary}.

DynamoDB is a great NoSQL service provided by Amazon, but the API is verbose.
PynamoDB presents you with a simple, elegant API.}

%description %{common_description}


%package -n     python3-pynamodb
Summary:        %{summary}

%description -n python3-pynamodb %{common_description}


%pyproject_extras_subpkg -n python3-pynamodb signals


%package        doc
Summary:        Documentation and examples for PynamoDB

%description doc %{common_description}


%prep
%autosetup -n PynamoDB-%{version} -p1

{
%if %{with doc_pdf}
  # Un-pin exact versions in doc dependencies.
  #
  # We can’t handle self-referential dependencies like .[signals]; we use the
  # -x argument to %%pyproject_buildrequires instead
  sed -r -e 's/==/>=/' -e 's/^\.\[/# &/' docs/requirements.txt
%endif
  # Get non-CI dev dependencies (no coverage/linting)
  awk '/^# only used in CI/ {ci=1}; !ci' requirements-dev.txt
} | tee requirements-filtered.txt


%generate_buildrequires
%pyproject_buildrequires -x signals requirements-filtered.txt


%build
%pyproject_wheel

%if %{with doc_pdf}
%make_build -C docs SPHINXOPTS='-j%{?_smp_build_ncpus}' latex
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
%endif


%install
%pyproject_install
%pyproject_save_files -l pynamodb


%check
# The integration tests need to connect to a local copy of DynamoDB; see the
# “Run dynamodb_local” step in .github/workflows.test.yaml. We can’t use a
# pre-compiled Java application for testing, and only a negligible number of
# integration tests can work without it, so we skip the integration tests.
%pytest --ignore-glob='tests/integration/*' -v


%files -n python3-pynamodb -f %{pyproject_files}
%doc README.rst


%files doc
%license LICENSE
%doc README.rst
%doc examples/
%if %{with doc_pdf}
%doc docs/_build/latex/PynamoDB.pdf
%endif


%changelog
## START: Generated by rpmautospec
* Wed May 29 2024 Packit <hello@packit.dev> - 6.0.1-1
- Update to 6.0.1 upstream release
- Resolves: rhbz#2283862

* Thu Feb 29 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 6.0.0-1
- Update to 6.0.0 (close RHBZ#2258350)

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.5.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

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

* Mon Dec 18 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 5.5.1-3
- Assert that %%pyproject_files contains a license file

* Wed Nov 29 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 5.5.1-1
- Update to 5.5.1 (close RHBZ#2252038)

* Wed Nov 29 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 5.5.0-6
- In setup.cfg, avoid deprecated license_file

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

* Tue Jul 04 2023 Python Maint <python-maint@redhat.com> - 5.5.0-4
- Rebuilt for Python 3.12

* Mon Jun 19 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 5.5.0-3
- Use new (rpm 4.17.1+) bcond style

* Wed Apr 26 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 5.5.0-1
- Update to 5.5.0 (close RHBZ#2189719)

* Sat Mar 18 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 5.4.1-2
- Don’t assume %%_smp_mflags is -j%%_smp_build_ncpus

* Tue Feb 21 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 5.4.1-1
- Update to 5.4.1 (close RHBZ#2171979)

* Tue Jan 31 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 5.4.0-1
- Update to 5.4.0 (close RHBZ#2165144)

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

* Wed Dec 21 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.3.4-2
- Indicate dirs. in files list with trailing slashes

* Thu Dec 08 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.3.4-1
- Update to 5.3.4 (close RHBZ#2151749)

* Sun Nov 27 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.3.3-1
- Update to 5.3.3 (close RHBZ#2148682)

* Sat Nov 19 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.3.2-1
- Update to 5.3.2 (close RHBZ#2144024)

* Fri Nov 18 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.3.1-1
- Update to 5.3.1 (close RHBZ#2143845)

* Thu Nov 03 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.3.0-1
- Update to 5.3.0 (close RHBZ#2139576)

* Tue Oct 25 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.2.3-1
- Update to 5.2.3 (close RHBZ#2137654)

* Tue Oct 25 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.2.1-5
- Confirm License is SPDX MIT

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

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

* Thu Mar 24 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.2.1-2
- Allow generating pytest-env BR

* Wed Feb 09 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.2.1-1
- Update to 5.2.1 (close RHBZ#2052736)

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

* Wed Jan 05 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 5.2.0-1
- Update to 5.2.0 (close RHBZ#2037116)

* Tue Dec 28 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 5.1.0-1
- Initial package (close RHBZ#2033924)
## END: Generated by rpmautospec