%global python3_pkgversion 3.11 # what it's called on pypi %global srcname graphviz %global common_description %{expand: This package facilitates the creation and rendering of graph descriptions in the DOT language of the Graphviz graph drawing software (master repo) from Python. Create a graph object, assemble the graph by adding nodes and edges, and retrieve its DOT source code string. Save the source code to a file and render it with the Graphviz installation of your system.} Name: python-%{srcname} Version: 0.20.1 Release: 2.ac14.py3.11%{?dist} # Set Epoch to avoid being obsoleted by graphviz-python Epoch: 1 Summary: Simple Python interface for Graphviz License: MIT URL: https://github.com/xflr6/graphviz Source0: %url/archive/%{version}/%{srcname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel %description %{common_description} %package -n python%{python3_pkgversion}-%{srcname} Summary: %{summary} Requires: graphviz %description -n python%{python3_pkgversion}-%{srcname} %{common_description} %package -n python-%{srcname}-doc Summary: Documentation for %{name} %description -n python-%{srcname}-doc %{common_description} This is the documentation package for %{name}. %prep %autosetup -p1 -n %{srcname}-%{version} sed -i 's/\r//' docs/*.rst sed -i 's/\r//' README.rst %generate_buildrequires %pyproject_buildrequires -t -x docs echo "graphviz" %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 # Compatibility with pytest 8 # Workaround for: https://github.com/xflr6/graphviz/issues/219 cat tests/backend/conftest.py >> tests/conftest.py rm tests/backend/conftest.py %pytest --skip-exe \ --only-exe \ --collect-only \ --verbose \ --pdb \ --exitfirst \ --doctest-report none 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.txt %changelog * Sat Apr 27 2024 Ding-Yi Chen - 0.20.1-2.ac14.py3.11 - Cut corner packaging