File python-django-rich.spec of Package python-django-rich
#
# spec file for package python-django-rich
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%endif
%if "%{flavor}" == ""
%define psuffix %{nil}
%bcond_with test
%endif
Name: python-django-rich
Version: 1.9.0
Release: 0
Summary: Extensions for using Rich with Django
License: MIT
URL: https://github.com/adamchainz/django-rich
Source: https://github.com/adamchainz/django-rich/archive/refs/tags/%{version}.tar.gz#/django-rich-%{version}.tar.gz
BuildRequires: python-rpm-macros
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: %{python_module pip}
# SECTION test requirements
%if %{with test}
BuildRequires: %{python_module Django >= 3.2}
BuildRequires: %{python_module pytest-django}
BuildRequires: %{python_module rich >= 10.0.0}
%endif
# /SECTION
BuildRequires: fdupes
Requires: python-Django >= 3.2
Requires: python-rich >= 10.0.0
BuildArch: noarch
%python_subpackages
%description
Extensions for using Rich with Django.
%prep
%setup -q -n django-rich-%{version}
sed -i '/coverage/d' tests/testapp/__init__.py
sed -i 's/"python"/"python3"/' tests/*.py
%build
%if !%{with test}
%pyproject_wheel
%endif
%install
%pyproject_install
%if !%{with test}
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%if %{with test}
%check
export PYTHONPATH=${PWD}
%pytest -rs
# There are some failures here
#%%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m django test --settings tests.settings
%endif
%if !%{with test}
%files %{python_files}
%doc README.rst
%license LICENSE
%{python_sitelib}/django[-_]rich*/
%endif
%changelog