ab91221
%if 0%{?rhel} < 10
ab91221
# sphinx version is too old
ab91221
%bcond_with doc
ab91221
%else
ab91221
%bcond_without doc
ab91221
%endif
ab91221
85a52ca
%global pypi_name django-configurations
85a52ca
85a52ca
Name:           python-%{pypi_name}
ab91221
Version:        2.5
b9c5095
Release:        %autorelease
85a52ca
Summary:        A helper for organizing Django settings
85a52ca
ab91221
License:        BSD-3-Clause
85a52ca
URL:            https://django-configurations.readthedocs.io/
ab91221
Source:         %{pypi_source}
ab91221
Patch:          %{pypi_name}-adjust_test_cases.diff
ab91221
85a52ca
BuildArch:      noarch
85a52ca
ab91221
%global _description %{expand:
85a52ca
django-configurations eases Django project configuration by relying on the
85a52ca
composability of Python classes. It extends the notion of Django's module
85a52ca
based settings loading with well established object oriented programming
ab91221
patterns.}
ab91221
ab91221
%description %_description
85a52ca
85a52ca
%package -n     python3-%{pypi_name}
85a52ca
Summary:        %{summary}
85a52ca
%{?python_provide:%python_provide python3-%{pypi_name}}
85a52ca
85a52ca
BuildRequires:  python3-devel
ab91221
BuildRequires:  python3dist(pytest)
ab91221
ab91221
%description -n python3-%{pypi_name} %_description
85a52ca
ab91221
%if %{with doc}
85a52ca
%package -n python-%{pypi_name}-doc
85a52ca
Summary:        The documentation for %{name}
85a52ca
85a52ca
%description -n python-%{pypi_name}-doc
85a52ca
Documentation for %{name}.
ab91221
%endif
ab91221
85a52ca
85a52ca
%prep
ab91221
%autosetup -n %{pypi_name}-%{version} -p1
85a52ca
rm -rf %{pypi_name}.egg-info
85a52ca
ab91221
# Remove unnecessary test BRs
ab91221
sed -i '/coverage$/d' tox.ini
ab91221
sed -i '/coverage_enable_subprocess$/d' tox.ini
ab91221
ab91221
%generate_buildrequires
ab91221
%if %{with doc}
ab91221
%pyproject_buildrequires -e docs -t
ab91221
%else
ab91221
%pyproject_buildrequires -t
ab91221
%endif
ab91221
ab91221
85a52ca
%build
ab91221
%pyproject_wheel
ab91221
ab91221
%if %{with doc}
85a52ca
PYTHONPATH=${PWD} sphinx-build-3 docs html
85a52ca
rm -rf html/.{doctrees,buildinfo}
ab91221
%endif
ab91221
85a52ca
85a52ca
%install
ab91221
%pyproject_install
85a52ca
ab91221
%pyproject_save_files configurations
85a52ca
ab91221
ab91221
%check
ab91221
export DJANGO_CONFIGURATION="Test"
ab91221
export DJANGO_SETTINGS_MODULE="tests.settings.main"
ab91221
export PATH=$PATH:%{buildroot}%{_bindir}
ab91221
export PYTHONPATH=%{buildroot}%{python3_sitelib}:$(pwd)
ab91221
%pytest
ab91221
ab91221
ab91221
%files -n python3-%{pypi_name} -f %{pyproject_files}
85a52ca
%license LICENSE
85a52ca
%doc README.rst
85a52ca
%{_bindir}/django-cadmin
85a52ca
ab91221
%if %{with doc}
85a52ca
%files -n python-%{pypi_name}-doc
85a52ca
%doc html
85a52ca
%license LICENSE
ab91221
%endif
ab91221
85a52ca
85a52ca
%changelog
b9c5095
%autochangelog