summaryrefslogtreecommitdiff
path: root/dev-python/html5lib
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/html5lib')
-rw-r--r--dev-python/html5lib/Manifest2
-rw-r--r--dev-python/html5lib/files/html5lib-1.2_pre20240221-py314.patch41
-rw-r--r--dev-python/html5lib/html5lib-1.2_pre20240221.ebuild59
-rw-r--r--dev-python/html5lib/metadata.xml15
4 files changed, 117 insertions, 0 deletions
diff --git a/dev-python/html5lib/Manifest b/dev-python/html5lib/Manifest
new file mode 100644
index 000000000000..2aa2e3aabd91
--- /dev/null
+++ b/dev-python/html5lib/Manifest
@@ -0,0 +1,2 @@
+DIST html5lib-python-fd4f032bc090d44fb11a84b352dad7cbee0a4745.gh.tar.gz 259834 BLAKE2B cf55f9fed5d7fea54966e8add3a4d1db1cbd85f5a771e38f359494b53a9b45c0d5031f561d1e57b02f8b6061bca102a2fea4997da5c05841cf30a81adbeb8742 SHA512 3965f2c5b55a805d6d6b86866315a6f776d5237ac189a70d3d33e713c744b30c471424365e400af3f3bd23348070e598f138629f5d35568954aeb9c067e84860
+DIST html5lib-tests-9b4a29c943b3c905e46b26569bae16de8b373516.gh.tar.gz 141487 BLAKE2B 4a2c0769f9e76c5e093af130427b7cf5407a11bd80670ca00013cb15a8da0f3c58cb2ea5ff526d299d9ddfbdab4a5ae9bcb6d388d4c709a573aba9d031e8b81f SHA512 8be9d913a48a498717f3931eafe64f53e5810c01451bbbbbdf80cef51e3274a3c8af523388e55c72762842b416ec5853213102998673c030229029bcfc954fce
diff --git a/dev-python/html5lib/files/html5lib-1.2_pre20240221-py314.patch b/dev-python/html5lib/files/html5lib-1.2_pre20240221-py314.patch
new file mode 100644
index 000000000000..785f77b04c59
--- /dev/null
+++ b/dev-python/html5lib/files/html5lib-1.2_pre20240221-py314.patch
@@ -0,0 +1,41 @@
+https://bugs.gentoo.org/965490
+https://github.com/html5lib/html5lib-python/pull/589
+
+From b90dafff1bf342d34d539098013d0b9f318c7641 Mon Sep 17 00:00:00 2001
+From: Andrew Sukach <andrew@sukach.org>
+Date: Fri, 12 Sep 2025 21:53:31 -0700
+Subject: [PATCH] `setup.py`: fix version parsing on Python 3.14 (ast.Str
+ removed)
+
+Python 3.14 removes the ast.Str node type. String literals now appear
+as ast.Constant(value=str).
+Update the AST check to accept both ast.Str (for older Pythons) and
+ast.Constant with a string value (for Python 3.8+), allowing html5lib to
+build successfully on Python 3.14 while remaining compatible with older
+version.
+---
+ setup.py | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 30ee0575..42ab6f67 100644
+--- a/setup.py
++++ b/setup.py
+@@ -92,9 +92,14 @@ def default_environment():
+ for a in assignments:
+ if (len(a.targets) == 1 and
+ isinstance(a.targets[0], ast.Name) and
+- a.targets[0].id == "__version__" and
+- isinstance(a.value, ast.Str)):
+- version = a.value.s
++ a.targets[0].id == "__version__"):
++ if hasattr(ast, "Str") and isinstance(a.value, ast.Str):
++ version = a.value.s
++ elif (hasattr(ast, "Constant")
++ and isinstance(a.value, ast.Constant)
++ and isinstance(a.value.value, str)):
++ version = a.value.value
++assert version is not None
+
+ setup(name='html5lib',
+ version=version,
diff --git a/dev-python/html5lib/html5lib-1.2_pre20240221.ebuild b/dev-python/html5lib/html5lib-1.2_pre20240221.ebuild
new file mode 100644
index 000000000000..cea969dd9ae0
--- /dev/null
+++ b/dev-python/html5lib/html5lib-1.2_pre20240221.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{13..14} )
+PYTHON_REQ_USE="xml(+)"
+
+inherit distutils-r1
+
+EGIT_COMMIT="fd4f032bc090d44fb11a84b352dad7cbee0a4745"
+# html5lib/tests/testdata
+TEST_COMMIT="9b4a29c943b3c905e46b26569bae16de8b373516"
+MY_P=html5lib-python-${EGIT_COMMIT}
+TEST_P=html5lib-tests-${TEST_COMMIT}
+
+DESCRIPTION="HTML parser based on the HTML5 specification"
+HOMEPAGE="
+ https://github.com/html5lib/html5lib-python/
+ https://html5lib.readthedocs.io/
+ https://pypi.org/project/html5lib/
+"
+SRC_URI="
+ https://github.com/html5lib/html5lib-python/archive/${EGIT_COMMIT}.tar.gz
+ -> ${MY_P}.gh.tar.gz
+ test? (
+ https://github.com/html5lib/html5lib-tests/archive/${TEST_COMMIT}.tar.gz
+ -> ${TEST_P}.gh.tar.gz
+ )
+"
+S=${WORKDIR}/${MY_P}
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~x64-macos"
+
+RDEPEND="
+ >=dev-python/six-1.9[${PYTHON_USEDEP}]
+ >=dev-python/webencodings-0.5.1[${PYTHON_USEDEP}]
+"
+BDEPEND="
+ dev-python/pkg-resources[${PYTHON_USEDEP}]
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.2_pre20240221-py314.patch
+)
+
+EPYTEST_PLUGINS=( pytest-expect )
+distutils_enable_tests pytest
+
+src_prepare() {
+ if use test; then
+ mv "${WORKDIR}/${TEST_P}"/* html5lib/tests/testdata || die
+ fi
+
+ distutils-r1_src_prepare
+}
diff --git a/dev-python/html5lib/metadata.xml b/dev-python/html5lib/metadata.xml
new file mode 100644
index 000000000000..4904e8040af5
--- /dev/null
+++ b/dev-python/html5lib/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <longdescription>
+ html5lib is a pure-python library for parsing HTML. It is designed
+ to conform to the WHATWG HTML specification, as is implemented by
+ all major web browsers.
+ </longdescription>
+ <stabilize-allarches />
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>