mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-24 18:02:27 -09:00
package/python-html5lib: fix build with setuptools >= 82
Signed-off-by: Bernd Kuhls <bernd@kuhls.net> Cc: James Hilliard <james.hilliard1@gmail.com> Cc: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
4407ca0af9
commit
933d454d22
@@ -0,0 +1,36 @@
|
||||
From a29f42562056cca84108aadea37158f718fc8b92 Mon Sep 17 00:00:00 2001
|
||||
From: loqs <loqs@users.noreply.github.com>
|
||||
Date: Mon, 16 Mar 2026 22:33:37 +0000
|
||||
Subject: [PATCH] setup.py: except ImportError for missing pkg_resources
|
||||
|
||||
Missing pkg_resources indicates setuptools 82 or newer which is more recent that than 18.5 so the version check using pkg_resources can safely be skipped.
|
||||
|
||||
Upstream: https://github.com/html5lib/html5lib-python/pull/594
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
setup.py | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 30ee057..0aa584d 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -6,9 +6,12 @@ import sys
|
||||
|
||||
from os.path import join, dirname
|
||||
from setuptools import setup, find_packages, __version__ as setuptools_version
|
||||
-from pkg_resources import parse_version
|
||||
|
||||
-import pkg_resources
|
||||
+try:
|
||||
+ import pkg_resources
|
||||
+ from pkg_resources import parse_version
|
||||
+except ImportError:
|
||||
+ pkg_resources = None
|
||||
|
||||
try:
|
||||
import _markerlib.markers
|
||||
--
|
||||
2.47.3
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
From 0bf746e3ed39d8b10b31ad292a19aa2d98e7058c Mon Sep 17 00:00:00 2001
|
||||
From: loqs <loqs@users.noreply.github.com>
|
||||
Date: Mon, 16 Mar 2026 22:38:32 +0000
|
||||
Subject: [PATCH] conftest.py: Replace pkg_resources use with packaging
|
||||
|
||||
Upstream: https://github.com/html5lib/html5lib-python/pull/594
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
html5lib/tests/conftest.py | 22 +++++++++++++---------
|
||||
requirements-test.txt | 2 ++
|
||||
2 files changed, 15 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/html5lib/tests/conftest.py b/html5lib/tests/conftest.py
|
||||
index fffeb50..a1f6b21 100644
|
||||
--- a/html5lib/tests/conftest.py
|
||||
+++ b/html5lib/tests/conftest.py
|
||||
@@ -2,7 +2,12 @@ from __future__ import print_function
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
-import pkg_resources
|
||||
+from packaging.requirements import Requirement
|
||||
+from packaging.markers import Marker
|
||||
+try:
|
||||
+ from importlib import metadata
|
||||
+except ImportError:
|
||||
+ import importlib_metadata as metadata
|
||||
import pytest
|
||||
|
||||
from .tree_construction import TreeConstructionFile
|
||||
@@ -63,17 +68,16 @@ def pytest_configure(config):
|
||||
spec, marker = line.strip().split(";", 1)
|
||||
else:
|
||||
spec, marker = line.strip(), None
|
||||
- req = pkg_resources.Requirement.parse(spec)
|
||||
- if marker and not pkg_resources.evaluate_marker(marker):
|
||||
+ req = Requirement(spec)
|
||||
+ if marker and not Marker(marker).evaluate():
|
||||
msgs.append("%s not available in this environment" % spec)
|
||||
else:
|
||||
try:
|
||||
- installed = pkg_resources.working_set.find(req)
|
||||
- except pkg_resources.VersionConflict:
|
||||
- msgs.append("Outdated version of %s installed, need %s" % (req.name, spec))
|
||||
- else:
|
||||
- if not installed:
|
||||
- msgs.append("Need %s" % spec)
|
||||
+ installed = metadata.version(req.name)
|
||||
+ if not req.specifier.contains(installed, prereleases=True):
|
||||
+ msgs.append("Outdated version of %s installed, need %s" % (req.name, spec))
|
||||
+ except metadata.PackageNotFoundError:
|
||||
+ msgs.append("Need %s" % spec)
|
||||
|
||||
# Check cElementTree
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
--
|
||||
2.47.3
|
||||
|
||||
Reference in New Issue
Block a user