From b04ef9c6d2b15b542f1d8fac40b77ab797fb18da Mon Sep 17 00:00:00 2001 From: Adam Duskett Date: Thu, 26 Oct 2023 11:26:56 +0200 Subject: [PATCH] package/python-iptables: use sysconfig.get_path instead of get_python_lib distutils is removed in Python 3.12.0. Switch to using sysconfig.get_path to facilitate the migration. Signed-off-by: Adam Duskett Signed-off-by: Arnout Vandecappelle --- ...g-get_path-instead-of-get_python_lib.patch | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 package/python-iptables/0001-use-sysconfig-get_path-instead-of-get_python_lib.patch diff --git a/package/python-iptables/0001-use-sysconfig-get_path-instead-of-get_python_lib.patch b/package/python-iptables/0001-use-sysconfig-get_path-instead-of-get_python_lib.patch new file mode 100644 index 0000000000..2a4de3daf2 --- /dev/null +++ b/package/python-iptables/0001-use-sysconfig-get_path-instead-of-get_python_lib.patch @@ -0,0 +1,40 @@ +From fd415a3613fad872062fb7cb4e271ac1476402ef Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Tue, 24 Oct 2023 08:47:12 +0200 +Subject: [PATCH] use sysconfig.get_path instead of get_python_lib + +Distutils has been removed from python 3.12.0. Use sysconfig.get_path instead +of get_python_lib. + +Upstream: https://github.com/ldx/python-iptables/pull/340 + +Signed-off-by: Adam Duskett +--- + iptc/util.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/iptc/util.py b/iptc/util.py +index 04fe905..94befc5 100644 +--- a/iptc/util.py ++++ b/iptc/util.py +@@ -3,7 +3,7 @@ import os + import sys + import ctypes + import ctypes.util +-from distutils.sysconfig import get_python_lib ++import sysconfig + from itertools import product + from subprocess import Popen, PIPE + from sys import version_info +@@ -64,7 +64,7 @@ def _do_find_library(name): + + # probably we have been installed in a virtualenv + try: +- lib = ctypes.CDLL(os.path.join(get_python_lib(), name), ++ lib = ctypes.CDLL(os.path.join(sysconfig.get_path("purelib"), name), + mode=ctypes.RTLD_GLOBAL) + return lib + except: +-- +2.41.0 +