mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Merge [2.11..2.13] Support setuptools >= 61.2 in Python tests
Fix for #253, by mirroring the change from1c23f5e1e4
On top of that, fix setuptools version detection in buildpath.py. libraries/libapparmor/swig/python/test/buildpath.py: The changes introduced incc7f549665
targetted a wrong setuptools version (61.2). The change in build directory naming has been introduced with 62.0. Fixes #259 Fixes #39 The first 3 commits are based on https://gitlab.com/apparmor/apparmor/-/merge_requests/897, the other two come from https://gitlab.com/apparmor/apparmor/-/merge_requests/904. Since there are several differences between 2.13 and >= 3.0, I had to adjust the patches at several places. I propose this MR for 2.11, 2.12 and 2.13. MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/910 Approved-by: John Johansen <john@jjmx.net> Merged-by: John Johansen <john@jjmx.net> (cherry picked from commit3c047517a4
) Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
62a0549db2
commit
609fe42e75
5 changed files with 17 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
image: ubuntu:latest
|
image: ubuntu:latest
|
||||||
before_script:
|
before_script:
|
||||||
- export DEBIAN_FRONTEND=noninteractive && apt-get update -qq && apt-get install --no-install-recommends -y build-essential apache2-dev autoconf automake bison dejagnu flex libpam-dev libtool perl liblocale-gettext-perl pkg-config python-all-dev python3-all-dev pyflakes3 ruby-dev swig lsb-release python3-notify2 python3-psutil zlib1g-dev
|
- export DEBIAN_FRONTEND=noninteractive && apt-get update -qq && apt-get install --no-install-recommends -y build-essential apache2-dev autoconf automake bison dejagnu flex libpam-dev libtool perl liblocale-gettext-perl pkg-config python-all-dev python3-all-dev pyflakes3 ruby-dev swig lsb-release python3-notify2 python3-psutil python3-setuptools zlib1g-dev
|
||||||
- lsb_release -a
|
- lsb_release -a
|
||||||
- uname -a
|
- uname -a
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,7 @@ test_python.py: test_python.py.in $(top_builddir)/config.status
|
||||||
|
|
||||||
CLEANFILES = test_python.py
|
CLEANFILES = test_python.py
|
||||||
|
|
||||||
# bah, how brittle is this?
|
PYTHON_DIST_BUILD_PATH = '$(builddir)/../build/$$($(PYTHON) buildpath.py)'
|
||||||
PYTHON_DIST_BUILD_PATH = '$(builddir)/../build/$$($(PYTHON) -c "import distutils.util; import platform; print(\"lib.%s-%s\" %(distutils.util.get_platform(), platform.python_version()[:3]))")'
|
|
||||||
|
|
||||||
TESTS = test_python.py
|
TESTS = test_python.py
|
||||||
TESTS_ENVIRONMENT = \
|
TESTS_ENVIRONMENT = \
|
||||||
|
|
13
libraries/libapparmor/swig/python/test/buildpath.py
Normal file
13
libraries/libapparmor/swig/python/test/buildpath.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
# 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("."))) >= (62, 1):
|
||||||
|
identifier = sys.implementation.cache_tag
|
||||||
|
else:
|
||||||
|
identifier = "%d.%d" % sys.version_info[:2]
|
||||||
|
print("lib.%s-%s" % (sysconfig.get_platform(), identifier))
|
|
@ -41,7 +41,7 @@ ifdef USE_SYSTEM
|
||||||
LOGPROF?=aa-logprof
|
LOGPROF?=aa-logprof
|
||||||
else
|
else
|
||||||
# PYTHON_DIST_BUILD_PATH based on libapparmor/swig/python/test/Makefile.am
|
# PYTHON_DIST_BUILD_PATH based on libapparmor/swig/python/test/Makefile.am
|
||||||
PYTHON_DIST_BUILD_PATH = ../libraries/libapparmor/swig/python/build/$$($(PYTHON) -c "import distutils.util; import platform; print(\"lib.%s-%s\" %(distutils.util.get_platform(), platform.python_version()[:3]))")
|
PYTHON_DIST_BUILD_PATH = ../libraries/libapparmor/swig/python/build/$$($(PYTHON) ../libraries/libapparmor/swig/python/test/buildpath.py)
|
||||||
LIBAPPARMOR_PATH=../libraries/libapparmor/src/.libs/
|
LIBAPPARMOR_PATH=../libraries/libapparmor/src/.libs/
|
||||||
LD_LIBRARY_PATH=$(LIBAPPARMOR_PATH):$(PYTHON_DIST_BUILD_PATH)
|
LD_LIBRARY_PATH=$(LIBAPPARMOR_PATH):$(PYTHON_DIST_BUILD_PATH)
|
||||||
PYTHONPATH=../utils/:$(PYTHON_DIST_BUILD_PATH)
|
PYTHONPATH=../utils/:$(PYTHON_DIST_BUILD_PATH)
|
||||||
|
|
|
@ -27,8 +27,7 @@ ifdef USE_SYSTEM
|
||||||
BASEDIR=
|
BASEDIR=
|
||||||
PARSER=
|
PARSER=
|
||||||
else
|
else
|
||||||
# PYTHON_DIST_BUILD_PATH based on libapparmor/swig/python/test/Makefile.am
|
PYTHON_DIST_BUILD_PATH = ../../libraries/libapparmor/swig/python/build/$$($(PYTHON) ../../libraries/libapparmor/swig/python/test/buildpath.py)
|
||||||
PYTHON_DIST_BUILD_PATH = ../../libraries/libapparmor/swig/python/build/$$($(PYTHON) -c "import distutils.util; import platform; print(\"lib.%s-%s\" %(distutils.util.get_platform(), platform.python_version()[:3]))")
|
|
||||||
LIBAPPARMOR_PATH=../../libraries/libapparmor/src/.libs/
|
LIBAPPARMOR_PATH=../../libraries/libapparmor/src/.libs/
|
||||||
LD_LIBRARY_PATH=$(LIBAPPARMOR_PATH):$(PYTHON_DIST_BUILD_PATH)
|
LD_LIBRARY_PATH=$(LIBAPPARMOR_PATH):$(PYTHON_DIST_BUILD_PATH)
|
||||||
PYTHONPATH=..:$(PYTHON_DIST_BUILD_PATH)
|
PYTHONPATH=..:$(PYTHON_DIST_BUILD_PATH)
|
||||||
|
|
Loading…
Add table
Reference in a new issue