Convert package to %pyproject RPM macros

This commit is contained in:
Miro Hrončok 2022-08-31 12:07:04 +02:00
parent eb057e7afa
commit 0a54307e77
1 changed files with 14 additions and 11 deletions

View File

@ -14,6 +14,7 @@ Source: %{pypi_source lxml}
BuildRequires: gcc
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
BuildRequires: python3-devel
%global _description \
lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It\
@ -25,9 +26,6 @@ XML Schema, XSLT, C14N and much more.
%package -n python3-lxml
Summary: %{summary}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython
Suggests: python3-lxml+cssselect
Suggests: python3-lxml+html5
Suggests: python3-lxml+htmlsoup
@ -36,18 +34,25 @@ Suggests: python3-lxml+htmlsoup
Python 3 version.
%python_extras_subpkg -n python3-lxml -i %{python3_sitearch}/lxml-*.egg-info cssselect html5 htmlsoup
%pyproject_extras_subpkg -n python3-lxml cssselect html5 htmlsoup
%prep
%autosetup -n lxml-%{version} -p1
%generate_buildrequires
%pyproject_buildrequires -x source,cssselect,html5,htmlsoup
# Remove pregenerated Cython C sources
find -type f -name '*.c' -print -delete
# We need to do this after %%pyproject_buildrequires because setup.py errors
# without Cython and without the .c files.
find -type f -name '*.c' -print -delete >&2
%build
env WITH_CYTHON=true %py3_build
export WITH_CYTHON=true
%pyproject_wheel
%install
%py3_install
%pyproject_install
%pyproject_save_files lxml
%check
# The tests assume inplace build, so we copy the built library to source-dir.
@ -56,11 +61,9 @@ cp -a build/lib.%{python3_platform}-*/* src/
# The options are: verbose, unit, functional
%{python3} test.py -vuf
%files -n python3-lxml
%license LICENSES.txt doc/licenses/BSD.txt doc/licenses/elementtree.txt
%files -n python3-lxml -f %{pyproject_files}
%license doc/licenses/BSD.txt doc/licenses/elementtree.txt
%doc README.rst src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt
%{python3_sitearch}/lxml/
%{python3_sitearch}/lxml-*.egg-info/
%changelog
* Wed Aug 31 2022 Miro Hrončok <mhroncok@redhat.com> - 4.7.1-6