diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..fcc7b97
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,3 @@
+
+ test
+
diff --git a/python-pycognito.changes b/python-pycognito.changes
index f68e6ad..c314ac1 100644
--- a/python-pycognito.changes
+++ b/python-pycognito.changes
@@ -1,3 +1,10 @@
+-------------------------------------------------------------------
+Mon Oct 7 13:43:57 UTC 2024 - Ben Greiner
+
+- Apply spec-cleaner and improve overall spec file quality
+- Test in multibuild in order to avoid illegal build dependency
+ cycle.
+
-------------------------------------------------------------------
Fri Oct 4 07:40:37 UTC 2024 - ecsos
diff --git a/python-pycognito.rpmlintrc b/python-pycognito.rpmlintrc
new file mode 100644
index 0000000..aace210
--- /dev/null
+++ b/python-pycognito.rpmlintrc
@@ -0,0 +1,2 @@
+# cryptography requirement comes from pyjwt[crypto]
+addFilter("python-leftover-require python3.*-cryptography")
diff --git a/python-pycognito.spec b/python-pycognito.spec
index 64bad08..c8c6d3d 100644
--- a/python-pycognito.spec
+++ b/python-pycognito.spec
@@ -16,8 +16,16 @@
#
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
%{?sle15_python_module_pythons}
-Name: python-pycognito
+Name: python-pycognito%{psuffix}
Version: 2024.5.1
Release: 0
Summary: Python class to integrate Boto3's Cognito client
@@ -25,57 +33,58 @@ License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/pvizeli/pycognito
Source: https://files.pythonhosted.org/packages/source/p/pycognito/pycognito-%{version}.tar.gz
-Source1: https://raw.githubusercontent.com/NabuCasa/pycognito/refs/heads/master/tests.py
-BuildRequires: python-rpm-macros
+Source1: https://github.com/NabuCasa/pycognito/raw/refs/tags/%{version}/tests.py
+Source99: python-pycognito.rpmlintrc
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
-# SECTION test requirements
-BuildRequires: %{python_module boto3 >= 1.10.49}
-BuildRequires: %{python_module envs >= 1.3}
-BuildRequires: %{python_module PyJWT >= 2.8.0}
-BuildRequires: %{python_module requests >= 2.22.0}
-BuildRequires: %{python_module pytest >= 8.2.1}
-BuildRequires: %{python_module freezegun >= 1.5.1}
-BuildRequires: %{python_module moto}
-BuildRequires: %{python_module joserfc}
-BuildRequires: %{python_module requests-mock >= 1.12.1}
-# /SECTION
BuildRequires: fdupes
-Requires: python-boto3 >= 1.10.49
-Requires: python-envs >= 1.3
+BuildRequires: python-rpm-macros
Requires: python-PyJWT >= 2.8.0
+Requires: python-boto3 >= 1.10.49
+# cryptography requirement comes from pyjwt[crypto]
+Requires: python-cryptography >= 3.4.0
+Requires: python-envs >= 1.3
Requires: python-requests >= 2.22.0
BuildArch: noarch
+%if %{with test}
+BuildRequires: %{python_module freezegun >= 1.5.1}
+BuildRequires: %{python_module joserfc}
+BuildRequires: %{python_module moto}
+BuildRequires: %{python_module pycognito = %{version}}
+BuildRequires: %{python_module pytest >= 8.2.1}
+BuildRequires: %{python_module requests-mock >= 1.12.1}
+%endif
%python_subpackages
%description
Python class to integrate Boto3's Cognito client so it is easy to login users. With SRP support.
%prep
-%autosetup -p1 -n pycognito-%{version}
-install %{SOURCE1} .
+%autosetup -p1 -n pycognito-%{version}
+cp %{SOURCE1} ./
+%if !%{with test}
%build
%pyproject_wheel
%install
%pyproject_install
-# Fix python-bytecode-inconsistent-mtime
-pushd %{buildroot}%{python_sitelib}
-find . -name '*.pyc' -exec rm -f '{}' ';'
-python%python_bin_suffix -m compileall *.py ';'
-popd
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%endif
+%if %{with test}
%check
donttest="test_srp_requests_http_auth"
%pytest -k "not ($donttest)" tests.py
+%endif
+%if !%{with test}
%files %{python_files}
%doc README.md
%license LICENSE
%{python_sitelib}/pycognito
%{python_sitelib}/pycognito-%{version}.dist-info
+%endif
%changelog