%global python3_pkgversion 3.11 %global srcname hyperlink %global common_description %{expand: The humble, but powerful, URL runs everything around us. Chances are you've used several just to read this text. Hyperlink is a featureful, pure-Python implementation of the URL, with an emphasis on correctness.} Name: python-%{srcname} Version: 21.0.0 Release: 2.ac16.py3.11%{?dist} Summary: A featureful, immutable, and correct URL for Python # MIT: main library # BSD: searchtools.js, websupport.js and modernizr.min.js # OFL: Inconsolata-Regular.ttf and Inconsolata-Bold.ttf License: MIT and BSD and OFL URL: https://github.com/python-hyper/hyperlink Source0: %url/archive/v%{version}/%{srcname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}dist(pytest) BuildRequires: python%{python3_pkgversion}dist(sphinx) BuildRequires: python%{python3_pkgversion}dist(sphinx-rtd-theme) %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 %build %pyproject_wheel # generate html docs 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 %pytest 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} %doc README.md %files doc %doc html %license LICENSE %changelog * Mon May 13 2024 Ding-Yi Chen - 21.0.0-2.ac16.py3.11 - Cut corner packaging