summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python/python3-html5lib/0001-setup.py-make-pkg_resources-import-optional-for-Pyth.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-html5lib/0001-setup.py-make-pkg_resources-import-optional-for-Pyth.patch')
-rw-r--r--meta-python/recipes-devtools/python/python3-html5lib/0001-setup.py-make-pkg_resources-import-optional-for-Pyth.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-html5lib/0001-setup.py-make-pkg_resources-import-optional-for-Pyth.patch b/meta-python/recipes-devtools/python/python3-html5lib/0001-setup.py-make-pkg_resources-import-optional-for-Pyth.patch
new file mode 100644
index 0000000000..f791b663f2
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-html5lib/0001-setup.py-make-pkg_resources-import-optional-for-Pyth.patch
@@ -0,0 +1,44 @@
1From 5bae4e7b62996f1ef1b9ee6719581bde115d762c Mon Sep 17 00:00:00 2001
2From: Peter Marko <peter.marko@siemens.com>
3Date: Fri, 13 Mar 2026 13:37:58 +0100
4Subject: [PATCH] setup.py: make pkg_resources import optional for Python 3.12+
5
6pkg_resources has been removed from newer Python/setuptools versions.
7Wrap the import in a try/except block and guard the usage site,
8allowing html5lib to build without pkg_resources present.
9
10Upstream-Status: Pending
11Signed-off-by: Peter Marko <peter.marko@siemens.com>
12---
13 setup.py | 10 +++++++---
14 1 file changed, 7 insertions(+), 3 deletions(-)
15
16diff --git a/setup.py b/setup.py
17index c393c9c..e659e98 100644
18--- a/setup.py
19+++ b/setup.py
20@@ -6,9 +6,13 @@ import sys
21
22 from os.path import join, dirname
23 from setuptools import setup, find_packages, __version__ as setuptools_version
24-from pkg_resources import parse_version
25
26-import pkg_resources
27+try:
28+ from pkg_resources import parse_version
29+ import pkg_resources
30+except ImportError:
31+ parse_version = None
32+ pkg_resources = None
33
34 try:
35 import _markerlib.markers
36@@ -49,7 +53,7 @@ if _markerlib and sys.version_info[0] == 3:
37 # Avoid the very buggy pkg_resources.parser, which doesn't consistently
38 # recognise the markers needed by this setup.py
39 # Change this to setuptools 20.10.0 to support all markers.
40-if pkg_resources:
41+if pkg_resources and parse_version:
42 if parse_version(setuptools_version) < parse_version('18.5'):
43 MarkerEvaluation = pkg_resources.MarkerEvaluation
44