## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%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

# tests are enabled by default
%bcond_without tests

%global         srcname        uamqp
%global         forgeurl       https://github.com/Azure/azure-uamqp-python/
Version:        1.6.0
# Microsoft devs released 1.6.0 on PyPi but forgot to tag the repo.
%global         commit         375b99b1c6aa890270bde6af2e2cc9e1630d8f0e
%forgemeta

Name:           python-%{srcname}
Release:        %autorelease
Summary:        AMQP 1.0 client library for Python

License:        MIT
URL:            %forgeurl
Source0:        %forgesource
# Fix build with GCC 11
Patch1:         %{name}-treat-warnings-as-warnings.patch

# Relax the range checks on the OpenSSL version
# OpenSSL 3.0 has a high degree of API compatibility with the 1.1.1
# branch, so the 1.1 code branches are also valid for higher versions.
#
# Note that this patch does not address the deprecation warnings
# introduced by OpenSSL 3.0.
#
# Proposed upstream by Ubuntu folks.
# https://github.com/Azure/azure-c-shared-utility/pull/577
Patch2:         python-uamqp-openssl3.patch

BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  openssl-devel
BuildRequires:  pyproject-rpm-macros
BuildRequires:  python3-devel
BuildRequires:  python3dist(cython)
BuildRequires:  python3dist(setuptools)

%if %{with tests}
BuildRequires:  python3dist(certifi)
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(pytest-asyncio)
BuildRequires:  python3dist(six)
%endif

%global         _description %{expand:An AMQP 1.0 client library for Python.}

%description
%{_description}


%package -n python3-%{srcname}
Summary:        %{summary}
%py_provides python3-%{srcname}

%description -n python3-%{srcname}
%{_description}


%prep
%forgeautosetup -p1


%generate_buildrequires
%pyproject_buildrequires -r


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files uamqp


%if %{with tests}
%check
%pytest --disable-warnings -k "not test_error_loop_arg_async"
%endif


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


%changelog
* Fri Sep 09 2022 Major Hayden <major@redhat.com> 1.6.0-1
- Update to 1.6.0

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

* Mon Jul 18 2022 Miro Hrončok <miro@hroncok.cz> 1.5.3-3
- Build with OpenSSL 3

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

* Thu Mar 24 2022 Major Hayden <major@mhtx.net> 1.5.3-1
- Update to 1.5.3

* Wed Mar 16 2022 Major Hayden <major@mhtx.net> 1.5.2-1
- Update to 1.5.2

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

* Thu Jan 13 2022 Major Hayden <major@mhtx.net> 1.5.1-1
- Update to 1.5.1

* Wed Jan 05 2022 Major Hayden <major@mhtx.net> 1.5.0-1
- Update to 1.5.0

* Mon Oct 11 2021 Major Hayden <major@mhtx.net> 1.4.3-1
- Update to 1.4.3

* Wed Sep 29 2021 Major Hayden <major@mhtx.net> 1.4.2-3
- Keep using openssl 1.1 until upstream bug fixed

* Wed Sep 29 2021 Major Hayden <major@mhtx.net> 1.4.2-2
- Fix tests

* Wed Sep 29 2021 Major Hayden <major@mhtx.net> 1.4.2-1
- Update to 1.4.2

* Tue Sep 14 2021 Sahana Prasad <sahana@redhat.com> 1.4.1-4
- Rebuilt with OpenSSL 3.0.0

* Tue Jul 27 2021 Fedora Release Engineering <releng@fedoraproject.org> 1.4.1-3
- Second attempt - Rebuilt for
  https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Jul 13 2021 Major Hayden <major@mhtx.net> 1.4.1-1
- Update to 1.4.1

* Sat Jul 03 2021 Major Hayden <major@mhtx.net> 1.4.0-1
- Revert "Update to 1.4.1"

* Sat Jul 03 2021 Major Hayden <major@mhtx.net> 1.4.1-1
- Update to 1.4.1

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

* Thu Jun 03 2021 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.4.0-1
- Update to 1.4.0

* Wed Apr 21 2021 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.3.0-1
- Update to 1.3.0

* Sun Mar 21 2021 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.2.15-1
- Update to 1.2.15

* Mon Feb 15 2021 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.2.14-1
- Update to 1.2.14

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

* Fri Dec 25 2020 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.2.12-1
- Update to 1.2.12

* Fri Dec 11 2020 Jeff Law <law@redhat.com> 1.2.11-2
- Fix prototype/definition mismatch caught by gcc-11

* Fri Oct 02 2020 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.2.11-1
- Update to 1.2.11

* Tue Aug 18 2020 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.2.10-1
- Update to 1.2.10

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

* Tue Jul 07 2020 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.2.9-1
- Update to 1.2.9

* Sun May 31 2020 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.2.8-2
- Rebuild for Python 3.9

* Fri May 29 2020 Mohamed El Morabity <melmorabity@fedoraproject.org> 1.2.8-1
- First import