From: Tobias Brunner Date: Mon, 9 Dec 2024 14:21:52 +0000 (+0100) Subject: vici: Update Python build X-Git-Tag: android-2.5.3~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3babf1f7108db2e81e53a4467065b5874a5544ac;p=thirdparty%2Fstrongswan.git vici: Update Python build Directly calling setup.py is deprecated (apparently has been for a while, but now we get large warnings). Direct installation is also discouraged. So this removes that option. The built wheel (the old egg format is not used/built anymore) can be installed manually in a venv or the like. --- diff --git a/.cirrus.yml b/.cirrus.yml index 08e3e071e0..fc6e65bab4 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -29,5 +29,7 @@ alpine_task: TEST: alpine OS_NAME: alpine - install_script: ./scripts/test.sh deps + install_script: + - ./scripts/test.sh deps + - ./scripts/test.sh pydeps script: ./scripts/test.sh diff --git a/configure.ac b/configure.ac index 5db5a93102..113172a8a0 100644 --- a/configure.ac +++ b/configure.ac @@ -70,7 +70,6 @@ ARG_WITH_SET([mpz_powm_sec], [yes], [use the more side-channel resistant ARG_WITH_SET([dev-headers], [no], [install strongSwan development headers to directory.]) ARG_WITH_SET([printf-hooks], [auto], [force the use of a specific printf hook implementation (auto, builtin, glibc, vstr).]) ARG_WITH_SET([rubygemdir], ["gem environment gemdir"], [path to install ruby gems to]) -ARG_WITH_SET([pythoneggdir], ["main site-packages directory"], [path to install python eggs to to]) if test -n "$PKG_CONFIG"; then systemdsystemunitdir_default=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) @@ -318,8 +317,8 @@ ARG_ENABL_SET([mediation], [enable IKEv2 Mediation Extension.]) ARG_ENABL_SET([unwind-backtraces],[use libunwind to create backtraces for memory leaks and segfaults.]) ARG_ENABL_SET([ruby-gems], [enable build of provided ruby gems.]) ARG_ENABL_SET([ruby-gems-install],[enable installation of provided ruby gems.]) -ARG_ENABL_SET([python-eggs], [enable build of provided python eggs.]) -ARG_ENABL_SET([python-eggs-install],[enable installation of provided python eggs.]) +ARG_ENABL_SET([python-wheels], [enable build of provided python wheels.]) +ARG_ENABL_SET([python-eggs], [legacy alias for --enable-python-wheels.]) ARG_ENABL_SET([perl-cpan], [enable build of provided perl CPAN module.]) ARG_ENABL_SET([perl-cpan-install],[enable installation of provided CPAN module.]) ARG_ENABL_SET([selinux], [enable SELinux support for labeled IPsec.]) @@ -497,8 +496,8 @@ if test x$ruby_gems_install = xtrue; then ruby_gems=true fi -if test x$python_eggs_install = xtrue; then - python_eggs=true +if test x$python_eggs = xtrue; then + python_wheels=true fi if test x$perl_cpan_install = xtrue; then @@ -1428,24 +1427,12 @@ if test x$ruby_gems = xtrue; then fi AM_CONDITIONAL(RUBY_GEMS_INSTALL, [test "x$ruby_gems_install" = xtrue]) -if test x$python_eggs = xtrue; then +if test x$python_wheels = xtrue; then PYTHON_PACKAGE_VERSION=`echo "$PACKAGE_VERSION" | $SED 's/dr/.dev/'` AC_SUBST([PYTHON_PACKAGE_VERSION]) - if test x$python_eggs_install = xtrue; then - AC_PATH_PROG([EASY_INSTALL], [easy_install], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) - if test x$EASY_INSTALL = x; then - AC_MSG_ERROR(Python easy_install not found) - fi - fi - if test "x$pythoneggdir" = "xmain site-packages directory"; then - AC_SUBST(PYTHONEGGINSTALLDIR, "") - else - AC_SUBST(PYTHONEGGINSTALLDIR, "--install-dir $pythoneggdir") - fi AC_PATH_PROG([TOX], [tox], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) AC_PATH_PROG([PY_TEST], [py.test], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) fi -AM_CONDITIONAL(PYTHON_EGGS_INSTALL, [test "x$python_eggs_install" = xtrue]) AM_CONDITIONAL(PERL_CPAN_INSTALL, [test "x$perl_cpan_install" = xtrue]) @@ -1910,7 +1897,7 @@ AM_CONDITIONAL(USE_LEGACY_SYSTEMD, test -n "$systemdsystemunitdir" -a "x$systemd AM_CONDITIONAL(USE_CERT_ENROLL, test x$cert_enroll = xtrue) AM_CONDITIONAL(USE_CERT_ENROLL_TIMER, test x$cert_enroll_timer = xtrue) AM_CONDITIONAL(USE_RUBY_GEMS, test x$ruby_gems = xtrue) -AM_CONDITIONAL(USE_PYTHON_EGGS, test x$python_eggs = xtrue) +AM_CONDITIONAL(USE_PYTHON_WHEELS, test x$python_wheels = xtrue) AM_CONDITIONAL(USE_PERL_CPAN, test x$perl_cpan = xtrue) AM_CONDITIONAL(USE_TOX, test "x$TOX" != x) AM_CONDITIONAL(USE_PY_TEST, test "x$PY_TEST" != x -a "x$TOX" = x) diff --git a/scripts/test.sh b/scripts/test.sh index 6180e2d8a6..6eeb4d1120 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -281,8 +281,7 @@ all|alpine|codeql|coverage|sonarcloud|no-dbg) --disable-osx-attr --disable-tkm --disable-uci --disable-unwind-backtraces --disable-svc --disable-dbghelp-backtraces --disable-socket-win - --disable-kernel-wfp --disable-kernel-iph --disable-winhttp - --disable-python-eggs-install" + --disable-kernel-wfp --disable-kernel-iph --disable-winhttp" # not enabled on the build server CONFIG="$CONFIG --disable-af-alg" # unable to build Botan on Ubuntu 20.04 @@ -316,7 +315,7 @@ all|alpine|codeql|coverage|sonarcloud|no-dbg) # and no Clearsilver CONFIG="$CONFIG --disable-fast --disable-manager --disable-medsrv" fi - PYDEPS="tox" + PYDEPS="build tox" if test "$1" = "build-deps"; then if [ "$ID" = "ubuntu" -a "$VERSION_ID" != "20.04" ]; then build_botan diff --git a/src/libcharon/plugins/vici/Makefile.am b/src/libcharon/plugins/vici/Makefile.am index e8bcdbaa38..1cb03a12dc 100644 --- a/src/libcharon/plugins/vici/Makefile.am +++ b/src/libcharon/plugins/vici/Makefile.am @@ -80,7 +80,7 @@ if USE_RUBY_GEMS SUBDIRS += ruby endif -if USE_PYTHON_EGGS +if USE_PYTHON_WHEELS SUBDIRS += python endif diff --git a/src/libcharon/plugins/vici/python/.gitignore b/src/libcharon/plugins/vici/python/.gitignore index d4813d691d..0542681ca8 100644 --- a/src/libcharon/plugins/vici/python/.gitignore +++ b/src/libcharon/plugins/vici/python/.gitignore @@ -1,3 +1,4 @@ +.eggs .tox *.pyc build diff --git a/src/libcharon/plugins/vici/python/Makefile.am b/src/libcharon/plugins/vici/python/Makefile.am index 425623b08b..4ea29b9f88 100644 --- a/src/libcharon/plugins/vici/python/Makefile.am +++ b/src/libcharon/plugins/vici/python/Makefile.am @@ -16,29 +16,14 @@ $(srcdir)/setup.py: $(srcdir)/setup.py.in $(top_builddir)/config.status -e "s:@EGG_VERSION@:$(PYTHON_PACKAGE_VERSION):" \ $(srcdir)/setup.py.in > $@ -all-local: dist/vici-$(PYTHON_PACKAGE_VERSION)-py$(PYTHON_VERSION).egg +all-local: dist/vici-$(PYTHON_PACKAGE_VERSION)-py3-none-any.whl -dist/vici-$(PYTHON_PACKAGE_VERSION)-py$(PYTHON_VERSION).egg: $(EXTRA_DIST) $(srcdir)/setup.py - (cd $(srcdir); $(PYTHON) setup.py bdist_egg \ - -b $(shell readlink -f $(builddir))/build \ - -d $(shell readlink -f $(builddir))/dist) - -package: $(EXTRA_DIST) $(srcdir)/setup.py - (cd $(srcdir); $(PYTHON) setup.py sdist \ - -d $(shell readlink -f $(builddir))/dist \ - bdist_wheel --universal \ - -d $(shell readlink -f $(builddir))/dist) +dist/vici-$(PYTHON_PACKAGE_VERSION)-py3-none-any.whl: $(EXTRA_DIST) $(srcdir)/setup.py + (cd $(srcdir); $(PYTHON) -m build -o $(abs_builddir)/dist) clean-local: - (cd $(srcdir); [ ! -f setup.py ] || $(PYTHON) setup.py clean -a) rm -rf $(srcdir)/setup.py $(srcdir)/vici.egg-info $(builddir)/dist -if PYTHON_EGGS_INSTALL -install-exec-local: dist/vici-$(PYTHON_PACKAGE_VERSION)-py$(PYTHON_VERSION).egg - $(EASY_INSTALL) $(PYTHONEGGINSTALLDIR) \ - dist/vici-$(PYTHON_PACKAGE_VERSION)-py$(PYTHON_VERSION).egg -endif - if USE_TOX TESTS_ENVIRONMENT += export TOX=$(TOX); AM_TESTS_FD_REDIRECT = 1>&2 @@ -48,5 +33,3 @@ endif if USE_PY_TEST TESTS = $(PY_TEST) endif - -.PHONY: package diff --git a/testing/scripts/build-baseimage b/testing/scripts/build-baseimage index 257cbfe3a0..62fdd5dbe8 100755 --- a/testing/scripts/build-baseimage +++ b/testing/scripts/build-baseimage @@ -19,7 +19,7 @@ INC=$INC,openssl,vim,sqlite3,conntrack,gdb,cmake,libltdl-dev,wget,gnupg,man-db INC=$INC,libboost-thread-dev,libboost-system-dev,git,iperf,htop,valgrind,strace INC=$INC,gnat,gprbuild,acpid,acpi-support-base,libldns-dev,libunbound-dev INC=$INC,dnsutils,libsoup2.4-dev,ca-certificates,unzip,libsystemd-dev -INC=$INC,python3,python3-setuptools,python3-dev,python3-daemon,python3-venv, +INC=$INC,python3,python3-setuptools,python3-build,python3-dev,python3-daemon,python3-venv, INC=$INC,apt-transport-https,libjson-c-dev,libxslt1-dev,libapache2-mod-wsgi-py3 INC=$INC,libxerces-c-dev,rsyslog case "$BASEIMGSUITE" in