%global python3_pkgversion 3.11 %global srcname 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.} Name: python-%{srcname} Version: 15.1.0 Release: 2.ac15.py3.11%{?dist} 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: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}dist(sphinx-rtd-theme) # the tests are enabled by default but can be disabled # to avoid a circular dependency on twisted->constantly %bcond tests 0 %if %{with tests} BuildRequires: python%{python3_pkgversion}dist(twisted) %endif %description %{common_description} %package -n python%{python3_pkgversion}-%{srcname} Summary: %{summary} %description -n python%{python3_pkgversion}-%{srcname} %{common_description} %package doc Summary: Documentation for %{name} %description doc %{common_description} This is the documentation package for %{name}. %prep %autosetup -p1 -n %{srcname}-%{version} %generate_buildrequires %pyproject_buildrequires %{?with_tests:-t} %build %pyproject_wheel PYTHONPATH=%{pyproject_build_lib} sphinx-build-%{python3_pkgversion} docs html # remove the sphinx-build-%{python3_pkgversion} leftovers rm -rf html/.{doctrees,buildinfo} %install %pyproject_install %pyproject_save_files %{srcname} %check %pyproject_check_import %if %{with tests} %tox %endif for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s|(.*)$|\1-%{python3_pkgversion}|"<<<"$b"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s|(.*).([1-8])(.*)$|\1-%{python3_pkgversion}.\2\3|"<<<"$m"); done for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s|(.*).mo$|\1-%{python3_pkgversion}.mo|"<<<"$m"); done for l in $(find %{buildroot}/usr/lib64/lib* -type f -o -type l) ; do mv "$l" $(sed -re "s|(.*).so(.*)$|\1-py%{python3_pkgversion}.so\2|"<<<"$l"); done for p in $(find %{buildroot}/usr/lib64/pkgconfig/* -type f) ; do mv "$p" $(sed -re "s|(.*).pc$|\1-py%{python3_pkgversion}.pc|"<<<"$p"); done %files -n python%{python3_pkgversion}-%{srcname} -f %{pyproject_files} %files -n python-%{srcname}-doc %doc html %license LICENSE %changelog * Sun May 05 2024 Ding-Yi Chen - 15.1.0-2.ac15.py3.11 - Cut corner packaging