]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
vici: Update Python build
authorTobias Brunner <tobias@strongswan.org>
Mon, 9 Dec 2024 14:21:52 +0000 (15:21 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 11 Dec 2024 14:18:09 +0000 (15:18 +0100)
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.

.cirrus.yml
configure.ac
scripts/test.sh
src/libcharon/plugins/vici/Makefile.am
src/libcharon/plugins/vici/python/.gitignore
src/libcharon/plugins/vici/python/Makefile.am
testing/scripts/build-baseimage

index 08e3e071e05278e90ff3e0d7754a167f6e811b08..fc6e65bab4a006a37e20231257b662de309c55d3 100644 (file)
@@ -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
index 5db5a931023679c457c595875313d7916b33aae1..113172a8a07d150579a1f4b11168290f1d7e512a 100644 (file)
@@ -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)
index 6180e2d8a672be301cb34d403b616bf0efe153d0..6eeb4d1120bab15f3945e57deda3382529b953f2 100755 (executable)
@@ -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
index e8bcdbaa3891a9fd4f5eb8348e893ea8e2438cfb..1cb03a12dc3310554c2aec0a04d6f59ebe694f65 100644 (file)
@@ -80,7 +80,7 @@ if USE_RUBY_GEMS
 SUBDIRS += ruby
 endif
 
-if USE_PYTHON_EGGS
+if USE_PYTHON_WHEELS
 SUBDIRS += python
 endif
 
index d4813d691d2ee25ea348d0b2e7b2d1be79f689ff..0542681ca8f5556864a3f40dcd48492c451eee89 100644 (file)
@@ -1,3 +1,4 @@
+.eggs
 .tox
 *.pyc
 build
index 425623b08bf783a343f9249706aae3a9df6c3dd7..4ea29b9f88fb38abd41b6becce68dcc6eb0fc467 100644 (file)
@@ -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
index 257cbfe3a07b824869631150d9c0b2d07c78e600..62fdd5dbe853167351f190892e9d2ebf9750911f 100755 (executable)
@@ -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