File python-attrs.spec of Package python-attrs

%{?vortex_header}%{!?vortex_header:%global vortex_pkg vortex-2024-07}

%global modname attrs

%if 0%{?rhel}
# Avoid unwanted/unavailable dependencies in RHEL builds
%bcond_with tests
%else
# Turn the tests off when bootstrapping Python, because pytest requires attrs
%bcond_without tests
%endif

Name:           python-attrs
Version:        23.2.0
Release:        %autorelease
Summary:        Python attributes without boilerplate

# SPDX
License:        MIT
URL:            http://www.attrs.org/
BuildArch:      noarch
Source0:        https://github.com/python-attrs/%{modname}/archive/%{version}/%{modname}-%{version}.tar.gz

# Fix of tests for Python 3.13
Patch:          https://github.com/python-attrs/attrs/commit/f9ff9135b4.patch

# Add compatibility with pytest 8
# https://github.com/python-attrs/attrs/pull/1249.patch
Patch:          pytest8-compatibility.patch

BuildRequires:  %{vortex_pkg}-python3-devel

%description
attrs is an MIT-licensed Python package with class decorators that
ease the chores of implementing the most common attribute-related
object protocols.

%package -n %{vortex_pkg}-python3-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{modname}}

%description -n %{vortex_pkg}-python3-%{modname}
attrs is an MIT-licensed Python package with class decorators that
ease the chores of implementing the most common attribute-related
object protocols.

%prep
%autosetup -p1 -n %{modname}-%{version}
# Remove undesired/optional test dependency on pympler
sed -i '/"pympler",/d' pyproject.toml

# Remove tests-mypy extra from tests-no-zope extra
sed -i "/attrs\[tests-mypy\]/d" pyproject.toml

%generate_buildrequires
%pyproject_buildrequires %{?with_tests:-x tests}

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files attr attrs

%check
%pyproject_check_import
%if %{with tests}
%pytest
%endif

%files -n %{vortex_pkg}-python3-%{modname} -f %{pyproject_files}
%license LICENSE
%doc README.md

%changelog
%autochangelog
openSUSE Build Service is sponsored by