diff --git a/python-html5lib.spec b/python-html5lib.spec
index a006a61..b2c566d 100644
--- a/python-html5lib.spec
+++ b/python-html5lib.spec
@@ -12,6 +12,13 @@ Patch: %{url}/pull/506.patch
BuildArch: noarch
+BuildRequires: python3-devel
+
+# Test deps
+# Upstream uses requirements-test.txt but it has tox, coverage, mock, flake8 in it
+BuildRequires: python3dist(pytest)
+BuildRequires: python3dist(pytest-expect)
+
%description
A python based HTML parser/tokenizer based on the WHATWG HTML5
specification for maximum compatibility with major desktop web browsers.
@@ -19,19 +26,6 @@ specification for maximum compatibility with major desktop web browsers.
%package -n python3-html5lib
Summary: %{summary}
-BuildRequires: python3-devel
-BuildRequires: python3-setuptools
-
-# Test deps
-BuildRequires: python3dist(pytest)
-BuildRequires: python3dist(pytest-expect)
-BuildRequires: python3dist(six)
-BuildRequires: python3dist(webencodings)
-
-# Optional test deps:
-BuildRequires: python3dist(chardet)
-BuildRequires: python3dist(genshi)
-BuildRequires: python3dist(lxml)
%description -n python3-html5lib
A python based HTML parser/tokenizer based on the WHATWG HTML5
@@ -45,23 +39,25 @@ specification for maximum compatibility with major desktop web browsers.
# 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
-%py3_build
+%pyproject_wheel
%install
-%py3_install
+%pyproject_install
+%pyproject_save_files html5lib
%check
%pytest
-%files -n python3-html5lib
-%license LICENSE
+%files -n python3-html5lib -f %{pyproject_files}
%doc CHANGES.rst README.rst
-%{python3_sitelib}/html5lib-*.egg-info/
-%{python3_sitelib}/html5lib/
%changelog