From b9b69e8fb0d636aca3b29186333aacf4011056139a54679617e40916c2b09671 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 3 Jul 2024 16:23:17 +0000 Subject: [PATCH] Use same package decl for doc multibuild OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-rdflib?expand=0&rev=67 --- python-rdflib.spec | 66 ++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/python-rdflib.spec b/python-rdflib.spec index 2e5fdca..8bfc801 100644 --- a/python-rdflib.spec +++ b/python-rdflib.spec @@ -19,19 +19,41 @@ %global flavor @BUILD_FLAVOR@%{nil} %if "%{flavor}" == "doc" %bcond_without doc +%define psuffix -doc %else %bcond_with doc +%define psuffix %{nil} %endif # Tests don't work and cause a dependency loop with python-SPARQLWrapper %bcond_with tests -Name: python-rdflib +Name: python-rdflib%{psuffix} Version: 7.0.0 Release: 0 Summary: A Python library for working with RDF License: BSD-3-Clause URL: http://rdflib.net/ Source: https://files.pythonhosted.org/packages/source/r/rdflib/rdflib-%{version}.tar.gz +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires(post): update-alternatives +Requires(postun): update-alternatives +BuildArch: noarch + +%if %{with tests} +BuildRequires: %{python_module SPARQLWrapper} +BuildRequires: %{python_module flake8} +BuildRequires: %{python_module pytest} +%endif + +%if %{with doc} +BuildRequires: %{python_module rdflib = %{version}} +BuildRequires: python3-Sphinx +BuildRequires: python3-myst-parser +BuildRequires: python3-sphinx-autodoc-typehints +BuildRequires: python3-sphinxcontrib-apidoc +Provides: %{python_module rdflib-doc = %{version}} +%else BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module html5lib} BuildRequires: %{python_module isodate} @@ -40,26 +62,11 @@ BuildRequires: %{python_module poetry-core} BuildRequires: %{python_module pyparsing} BuildRequires: %{python_module wheel} BuildRequires: %{python_module xml} -BuildRequires: fdupes -BuildRequires: python-rpm-macros -BuildRequires: python3-Sphinx -BuildRequires: python3-myst-parser -BuildRequires: python3-sphinxcontrib-apidoc Requires: python-html5lib Requires: python-isodate Requires: python-pyparsing -Requires(post): update-alternatives -Requires(postun): update-alternatives -BuildArch: noarch -%if %{with tests} -BuildRequires: %{python_module SPARQLWrapper} -BuildRequires: %{python_module flake8} -BuildRequires: %{python_module pytest} -%endif -%if %{with doc} -BuildRequires: python3-sphinx-autodoc-typehints -%endif %python_subpackages +%endif %description RDFLib is a Python library for working with RDF, a simple yet powerful @@ -67,21 +74,11 @@ language for representing information. The library contains an RDF/XML parser/serializer that conforms to the RDF/XML Syntax Specification (Revised). The library also contains both in-memory and persistent Graph backends. -%package -n %{name}-doc -Summary: A Python library for working with RDF -Provides: %{python_module rdflib-doc = %{version}} -BuildRequires: %{python_module rdflib = %{version}} - -%description -n %{name}-doc -RDFLib is a Python library for working with RDF, a simple yet powerful -language for representing information. The library contains an RDF/XML -parser/serializer that conforms to the RDF/XML Syntax Specification (Revised). -The library also contains both in-memory and persistent Graph backends. - %prep %autosetup -p1 -n rdflib-%{version} # remove unwanted shebang find rdflib -name "*.py" | xargs sed -i '1 { /^#!/ d }' +chmod -x rdflib/plugins/parsers/notation3.py %if %{without doc} %build @@ -89,7 +86,6 @@ find rdflib -name "*.py" | xargs sed -i '1 { /^#!/ d }' %endif %install - %if %{with doc} # Build the docs, we need the module queryable pushd docs @@ -115,6 +111,12 @@ popd %pytest %endif +%if %{with doc} +%files -n %{name} +%doc docs/_build/html + +%else + %post %python_install_alternative rdfs2dot %python_install_alternative rdfpipe @@ -129,12 +131,6 @@ popd %python_uninstall_alternative rdf2dot %python_uninstall_alternative csv2rdf -%if %{with doc} -%files -n %{name}-doc -%doc docs/_build/html - -%else - %files %{python_files} %license LICENSE %doc README.md