%global pypi_name license-expression %global pypi_name_with_underscore %(echo "%{pypi_name}" | sed "s/-/_/g") Name: python-%{pypi_name} Version: 30.1.1 Release: %autorelease Summary: Utility library to parse, normalize and compare License expressions for Python License: Apache-2.0 URL: https://github.com/nexB/license-expression Source: %URL/archive/v%{version}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3dist(sphinx) BuildRequires: python3dist(sphinxcontrib-apidoc) BuildRequires: python3dist(sphinx-rtd-theme) %global common_description %{expand: license-expression is a comprehensive utility library to parse, compare, simplify and normalize license expressions (such as SPDX license expressions) using boolean logic.} %description %{common_description} %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %{common_description} %package -n python-%{pypi_name}-doc Summary: Documentation for python-%{pypi_name} BuildArch: noarch %description -n python-%{pypi_name}-doc %{common_description} This package is providing the documentation for %{pypi_name}. %prep %autosetup -p1 -n %{pypi_name}-%{version} sed -i 's|\(fallback_version = "\)[^"]*|\1%{version}|' pyproject.toml %generate_buildrequires %pyproject_buildrequires -t %build %pyproject_wheel # generate html docs sphinx-build-3 -b html docs/source html # remove the sphinx-build-3 leftovers rm -rf html/.{doctrees,buildinfo} %install %pyproject_install %pyproject_save_files %{pypi_name_with_underscore} %check %pytest %files -n python3-%{pypi_name} -f %{pyproject_files} %doc AUTHORS.rst CHANGELOG.rst CODE_OF_CONDUCT.rst README.rst %license NOTICE apache-2.0.LICENSE %files -n python-%{pypi_name}-doc %doc html %license NOTICE apache-2.0.LICENSE %changelog %autochangelog