nftables: fix builds with latest setuptools

Using a private module from setuptools is not a good idea and
no longer works with latest setuptools.

it's actually better to revert to official distutils even if
it is going away in the next python release. Hopefully by
then upstream will transition to something supported.

TMPDIR in .pyc can be addressed by simply not installing the .pyc.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Alexander Kanavin
2023-01-05 16:00:00 +01:00
committed by Khem Raj
parent b18f71ff96
commit ddfc9edc20
2 changed files with 5 additions and 45 deletions
@@ -1,44 +0,0 @@
From c7513195a72b2e5be5c9c439cc606eb5dcc3fb7a Mon Sep 17 00:00:00 2001
From: Alex Kiernan <alex.kiernan@gmail.com>
Date: Tue, 12 Jul 2022 17:44:34 +0100
Subject: [PATCH] nftables: python: Split root from prefix
The buildpaths QA check fails when python is enabled:
WARNING: nftables-1.0.4-r0 do_package_qa: QA Issue: File /usr/lib/python3.10/site-packages/nftables/__pycache__/nftables.cpython-310.pyc in package nftables-python contains reference to TMPDIR
File /usr/lib/python3.10/site-packages/nftables/__pycache__/__init__.cpython-310.pyc in package nftables-python contains reference to TMPDIR [buildpaths]
Upstream-Status: Pending
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---
py/Makefile.am | 2 +-
py/setup.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/py/Makefile.am b/py/Makefile.am
index 215ecd9e4751..a827cca10135 100644
--- a/py/Makefile.am
+++ b/py/Makefile.am
@@ -7,7 +7,7 @@ all-local:
install-exec-local:
cd $(srcdir) && \
$(PYTHON_BIN) setup.py build --build-base $(abs_builddir) \
- install --prefix $(DESTDIR)$(prefix)
+ install --root $(DESTDIR) --prefix $(prefix)
uninstall-local:
rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/nftables
diff --git a/py/setup.py b/py/setup.py
index 72fc8fd98b26..976aec583b71 100755
--- a/py/setup.py
+++ b/py/setup.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from distutils.core import setup
+from setuptools._distutils.core import setup
from nftables import NFTABLES_VERSION
setup(name='nftables',
--
2.35.1
@@ -7,7 +7,6 @@ DEPENDS = "libmnl libnftnl bison-native \
${@bb.utils.contains('PACKAGECONFIG', 'mini-gmp', '', 'gmp', d)}"
SRC_URI = "http://www.netfilter.org/projects/nftables/files/${BP}.tar.xz \
file://0001-nftables-python-Split-root-from-prefix.patch \
file://run-ptest \
"
SRC_URI[sha256sum] = "2407430ddd82987670e48dc2fda9e280baa8307abec04ab18d609df3db005e4c"
@@ -40,6 +39,11 @@ TESTDIR = "tests"
PRIVATE_LIBS:${PN}-ptest:append = "libnftables.so.1"
do_install:append() {
# Avoid "contains reference to TMPDIR" warning
find ${D} -name *.pyc -delete
}
do_install_ptest() {
cp -rf ${S}/build-aux ${D}${PTEST_PATH}
cp -rf ${S}/src ${D}${PTEST_PATH}