From 9c1438f59e8a415faf58f51ea1e0a2126282a3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 19 Sep 2022 19:30:51 +0200 Subject: [PATCH] Define a buildrequire_extras %bcond for bootstrapping --- python-lxml.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python-lxml.spec b/python-lxml.spec index 8fbb6d0..7170e82 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -21,6 +21,16 @@ BuildRequires: libxml2-devel BuildRequires: libxslt-devel BuildRequires: python3-devel +# It is a good idea to BuildRequire the runtime requirements of the [extras] we build. +# That way, we ensure all the [extras] we build are installable, +# and we possibly run tests that would otherwise be skipped. +# However, some of the extras here create a dependency loop. +# - [cssselect] Requires cssselect BuildRequires lxml +# - [html5] Requires html5lib BuildRequires lxml +# - [htmlsoup] Requires beautifulsoup4 Requires lxml +# Hence we provide a bcond to disable this buildtime requirement. +%bcond buildrequire_extras 1 + %global _description \ lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It\ provides safe and convenient access to these libraries using the ElementTree It\ @@ -45,7 +55,7 @@ Python 3 version. %autosetup -n lxml-%{version} -p1 %generate_buildrequires -%pyproject_buildrequires -x source,cssselect,html5,htmlsoup +%pyproject_buildrequires -x source%{?with_buildrequire_extras:,cssselect,html5,htmlsoup} # Remove pregenerated Cython C sources # We need to do this after %%pyproject_buildrequires because setup.py errors # without Cython and without the .c files.