%global python3_pkgversion 3.11 Name: python-html5lib Summary: A python based HTML parser/tokenizer Version: 1.1 Release: 4.ac1%{?dist} Epoch: 1 License: MIT URL: https://github.com/html5lib/html5lib-python Source: %{pypi_source html5lib} # Fix compatibility with pytest 6 Patch: %{url}/pull/506.patch # Fix compatibility with pytest 7.4.0 Patch: %{url}/pull/573.patch BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel # Test deps # Upstream uses requirements-test.txt but it has tox, coverage, mock, flake8 in it BuildRequires: python%{python3_pkgversion}dist(pytest) BuildRequires: python%{python3_pkgversion}dist(pytest-expect) %description A python based HTML parser/tokenizer based on the WHATWG HTML5 specification for maximum compatibility with major desktop web browsers. %package -n python%{python3_pkgversion}-html5lib Summary: %{summary} %description -n python%{python3_pkgversion}-html5lib A python based HTML parser/tokenizer based on the WHATWG HTML5 specification for maximum compatibility with major desktop web browsers. %pyproject_extras_subpkg -n python3-html5lib lxml genshi chardet all %prep %autosetup -p1 -n html5lib-%{version} # Use standard library unittest.mock instead of 3rd party mock # From https://github.com/html5lib/html5lib-python/pull/536 sed -i 's/from mock import/from unittest.mock import/' html5lib/tests/test_meta.py %generate_buildrequires %pyproject_buildrequires -x all %build %pyproject_wheel %install %pyproject_install %pyproject_save_files html5lib %check %pytest for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s/(.*)$/\1%{python3_pkgversion}/"<<<"$b"); done for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s/(.*).mo$/\1%{python3_pkgversion}.mo/"<<<"$m"); done %files -n python%{python3_pkgversion}-html5lib -f %{pyproject_files} %doc CHANGES.rst README.rst %changelog * Sun Mar 24 2024 Ding-Yi Chen - 1.1-4.ac1 - Cut corner packaging