From fda390983f77c2d218690522eba35aecf20aa332 Mon Sep 17 00:00:00 2001 From: David Runge Date: Tue, 2 Aug 2022 14:17:27 +0200 Subject: [PATCH 1/2] Fix setuptools version detection in buildpath.py libraries/libapparmor/swig/python/test/buildpath.py: The changes introduced in https://gitlab.com/apparmor/apparmor/-/commit/cc7f549665282c0a527d5424a6f9d726c50ddbb1 targetted a wrong setuptools version (61.2). The change in build directory naming has been introduced with 62.1 (https://github.com/pypa/setuptools/commit/1c23f5e1e4b18b50081cbabb2dea22bf345f5894). --- libraries/libapparmor/swig/python/test/buildpath.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/libapparmor/swig/python/test/buildpath.py b/libraries/libapparmor/swig/python/test/buildpath.py index 6b805c1be..94b63c2e4 100644 --- a/libraries/libapparmor/swig/python/test/buildpath.py +++ b/libraries/libapparmor/swig/python/test/buildpath.py @@ -1,9 +1,12 @@ #!/usr/bin/python3 -# the build path has changed in setuptools 61.2 +# the build path has changed in setuptools 62.1: +# https://github.com/pypa/setuptools/commit/1c23f5e1e4b18b50081cbabb2dea22bf345f5894 import sys import sysconfig import setuptools -if tuple(map(int,setuptools.__version__.split("."))) >= (61, 2): + + +if tuple(map(int, setuptools.__version__.split("."))) >= (62, 1): identifier = sys.implementation.cache_tag else: identifier = "%d.%d" % sys.version_info[:2] From 1ff0c2c7d60f8de81afba2e362df032a3d1120a8 Mon Sep 17 00:00:00 2001 From: David Runge Date: Tue, 2 Aug 2022 14:50:39 +0200 Subject: [PATCH 2/2] Use basepath.py in profiles Makefile profiles/Makefile: Set PYTHON_DIST_BUILD_PATH using libraries/libapparmor/swig/python/test/buildpath.py as it solves the problem of setting the build directory generically. --- profiles/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/Makefile b/profiles/Makefile index 0b7f2655d..19d39a796 100644 --- a/profiles/Makefile +++ b/profiles/Makefile @@ -41,7 +41,7 @@ ifdef USE_SYSTEM LOGPROF?=aa-logprof else # PYTHON_DIST_BUILD_PATH based on libapparmor/swig/python/test/Makefile.am - PYTHON_DIST_BUILD_PATH = ../libraries/libapparmor/swig/python/build/$$($(PYTHON) -c "import sysconfig; print(\"lib.%s-%s\" %(sysconfig.get_platform(), sysconfig.get_python_version()))") + PYTHON_DIST_BUILD_PATH = ../libraries/libapparmor/swig/python/build/$$($(PYTHON) ../libraries/libapparmor/swig/python/test/buildpath.py) LIBAPPARMOR_PATH=../libraries/libapparmor/src/.libs/ LD_LIBRARY_PATH=$(LIBAPPARMOR_PATH):$(PYTHON_DIST_BUILD_PATH) PYTHONPATH=../utils/:$(PYTHON_DIST_BUILD_PATH)