Blob Blame History Raw
# what it's called on pypi
%global srcname constantly
# what it's imported as
%global libname constantly

%global common_description %{expand:
A library that provides symbolic constant support. It includes collections and
constants with text, numeric, and bit flag values. Originally
twisted.python.constants from the Twisted project.}

%bcond_without  check

Name:           python-%{srcname}
Version:        15.1.0
Release:        %autorelease
Summary:        Symbolic constants in Python

License:        MIT
URL:            https://github.com/twisted/constantly
Source0:        %url/archive/%{version}/%{srcname}-%{version}.tar.gz
# Refresh versioneer.py now generated with versioneer 0.21
# https://github.com/twisted/constantly/pull/27
Patch0:         0001-Update-versioneer.py-to-0.21.patch

BuildArch:      noarch
BuildRequires:  python3-devel

%description
%{common_description}

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

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

%package -n python-%{srcname}-doc
Summary:        Constantly documentation

%description -n python-%{srcname}-doc
Documentation for Constantly

%prep
%autosetup -p1 -n %{srcname}-%{version}

%generate_buildrequires
%pyproject_buildrequires -t
echo "python3dist(twisted)"
echo 'python3dist(sphinx-rtd-theme)'

%build
%pyproject_wheel

PYTHONPATH=${PWD} sphinx-build-3 docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%install
%pyproject_install
%pyproject_save_files %{libname}

%if %{with check}
%check
%tox
%endif

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

%files -n python-%{srcname}-doc
%doc html
%license LICENSE

%changelog
%autochangelog