automation: add python3's setuptools to containers
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/4 automation: add python3's setuptools to containers
In preparation of supporting both distutils and setuptools, add the python3 setuptools module to the containers that have recent python3 installations.
Debian Stretch, Ubuntu trusty (14.04), Ubuntu xenial (16.04) and Ubuntu bionic (18.04) are kept without setuptools on purpose, to test installations that don't have it.
Centos 7 in particular is kept with python2 only.
--- automation/build/alpine/3.18-arm64v8.dockerfile | 1 + automation/build/alpine/3.18.dockerfile | 1 + automation/build/archlinux/current.dockerfile | 1 + automation/build/debian/bookworm-arm64v8.dockerfile | 1 + automation/build/debian/bookworm-i386.dockerfile | 1 + automation/build/debian/bookworm.dockerfile | 1 + automation/build/suse/opensuse-leap.dockerfile | 1 + automation/build/suse/opensuse-tumbleweed.dockerfile | 1 + automation/build/ubuntu/focal.dockerfile | 1 + 9 files changed, 9 insertions(+)
automation/build/alpine/3.18-arm64v8.dockerfile +1 -0
@@ -32,6 +32,7 @@ RUN apk --no-cache add \ ocaml-findlib \ patch \ python3-dev \ + py3-setuptools \ texinfo \ util-linux-dev \ xz-dev \
automation/build/alpine/3.18.dockerfile +1 -0
@@ -34,6 +34,7 @@ RUN apk --no-cache add \ ocaml-findlib \ patch \ python3-dev \ + py3-setuptools \ texinfo \ util-linux-dev \ xz-dev \
automation/build/archlinux/current.dockerfile +1 -0
@@ -34,6 +34,7 @@ RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \ pixman \ pkgconfig \ python \ + python-setuptools \ sdl \ sdl2 \ spice \
automation/build/debian/bookworm-arm64v8.dockerfile +1 -0
@@ -16,6 +16,7 @@ RUN apt-get update && \ libncurses5-dev \ libssl-dev \ python3-dev \ + python3-setuptools \ xorg-dev \ uuid-dev \ libyajl-dev \
automation/build/debian/bookworm-i386.dockerfile +1 -0
@@ -18,6 +18,7 @@ RUN apt-get update && \ libncurses5-dev \ libssl-dev \ python3-dev \ + python3-setuptools \ xorg-dev \ uuid-dev \ libyajl-dev \
automation/build/debian/bookworm.dockerfile +1 -0
@@ -16,6 +16,7 @@ RUN apt-get update && \ libncurses5-dev \ libssl-dev \ python3-dev \ + python3-setuptools \ xorg-dev \ uuid-dev \ libyajl-dev \
automation/build/suse/opensuse-leap.dockerfile +1 -0
@@ -60,6 +60,7 @@ RUN zypper install -y --no-recommends \ 'pkgconfig(sdl)' \ 'pkgconfig(sdl2)' \ python3-devel \ + python3-setuptools \ systemd-devel \ tar \ transfig \
automation/build/suse/opensuse-tumbleweed.dockerfile +1 -0
@@ -63,6 +63,7 @@ RUN zypper install -y --no-recommends \ 'pkgconfig(sdl)' \ 'pkgconfig(sdl2)' \ python3-devel \ + python3-setuptools \ systemd-devel \ tar \ transfig \
automation/build/ubuntu/focal.dockerfile +1 -0
@@ -16,6 +16,7 @@ RUN apt-get update && \ libncurses5-dev \ libssl-dev \ python3-dev \ + python3-setuptools \ xorg-dev \ uuid-dev \ libyajl-dev \
Signature · 1 line
2.42.0
PATCH v3 2/4 tools: convert setup.py to use setuptools if available
In reply to a message not in the archiveFrom: Marek Marczykowski-Górecki <[email protected]>
Python distutils is deprecated and is going to be removed in Python 3.12. Add support for setuptools.
Setuptools in Python 3.11 complains:
SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
Keep using setup.py anyway to build the C extension.
--- tools/pygrub/setup.py | 7 +++++-- tools/python/setup.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-)
tools/pygrub/setup.py +5 -2
@@ -1,5 +1,8 @@ -from distutils.core import setup, Extension -from distutils.ccompiler import new_compiler +# Prefer setuptools, fall back to distutils +try: + from setuptools import setup, Extension +except ImportError: + from distutils.core import setup, Extension import os import sys
tools/python/setup.py +5 -2
@@ -1,5 +1,8 @@ - -from distutils.core import setup, Extension +# Prefer setuptools, fall back to distutils +try: + from setuptools import setup, Extension +except ImportError: + from distutils.core import setup, Extension import os, sys XEN_ROOT = "../.."
Signature · 1 line
2.42.0
PATCH v3 3/4 tools: don't use distutils in configure nor Makefile
In reply to a message not in the archiveFrom: Marek Marczykowski-Górecki <[email protected]>
Python distutils is deprecated and is going to be removed in Python 3.12. distutils.sysconfig is available as the sysconfig module in stdlib since Python 2.7 and Python 3.2, so use that directly.
Update the README to reflect that we now depend on Python 2.7.
Regenerate configure after the m4/python_devel.m4 change.
--- README | 4 ++-- m4/python_devel.m4 | 28 +++++++++++----------- tools/configure | 52 ++++++++++++++++------------------------ tools/libs/stat/Makefile | 4 ++-- 4 files changed, 38 insertions(+), 50 deletions(-)
README +2 -2
@@ -50,7 +50,7 @@ provided by your OS distributor: - GNU Binutils 2.24 or later * POSIX compatible awk * Development install of zlib (e.g., zlib-dev) - * Development install of Python 2.6 or later (e.g., python-dev) + * Development install of Python 2.7 or later (e.g., python-dev) * Development install of curses (e.g., libncurses-dev) * Development install of openssl (e.g., openssl-dev) * Development install of x11 (e.g. xorg-x11-dev)
@@ -180,7 +180,7 @@ Python Runtime Libraries Various tools, such as pygrub, have the following runtime dependencies: - * Python 2.6 or later. + * Python 2.7 or later. URL: https://www.python.org/ Debian: python
m4/python_devel.m4 +14 -14
@@ -5,21 +5,21 @@ ac_previous_libs=$LIBS AC_PATH_PROG([pyconfig], [$PYTHON-config], [no]) AS_IF([test x"$pyconfig" = x"no"], [ dnl For those that don't have python-config - CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print("-I" + distutils.sysconfig.get_config_var("INCLUDEPY"))'`" - CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("CFLAGS"))'`" - LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print("-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\ + CPPFLAGS="$CFLAGS `$PYTHON -c 'import sysconfig; \ + print("-I" + sysconfig.get_config_var("INCLUDEPY"))'`" + CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import sysconfig; \ + print(sysconfig.get_config_var("CFLAGS"))'`" + LDFLAGS="$LDFLAGS `$PYTHON -c 'import sysconfig; \ + print("-L" + sysconfig.get_python_lib(plat_specific=1,\ standard_lib=1) + "/config")'`" - LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("LINKFORSHARED"))'`" - LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("LDFLAGS"))'`" - LIBS="$LIBS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("LIBS"))'`" - LIBS="$LIBS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("SYSLIBS"))'`" + LDFLAGS="$LDFLAGS `$PYTHON -c 'import sysconfig; \ + print(sysconfig.get_config_var("LINKFORSHARED"))'`" + LDFLAGS="$LDFLAGS `$PYTHON -c 'import sysconfig; \ + print(sysconfig.get_config_var("LDFLAGS"))'`" + LIBS="$LIBS `$PYTHON -c 'import sysconfig; \ + print(sysconfig.get_config_var("LIBS"))'`" + LIBS="$LIBS `$PYTHON -c 'import sysconfig; \ + print(sysconfig.get_config_var("SYSLIBS"))'`" ], [ dnl If python-config is found use it CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
tools/configure +20 -32
119 lines not on this page · raw message
tools/libs/stat/Makefile +2 -2
@@ -73,8 +73,8 @@ $(PYLIB): $(PYSRC) python-bindings: $(PYLIB) $(PYMOD) pythonlibdir = $(shell $(PYTHON) -c \ - 'import distutils.sysconfig as cfg; \ - print(cfg.get_python_lib(False, False, prefix="$(prefix)"))') + 'import sysconfig; \ + print(sysconfig.get_python_lib("platlib", vars={"platbase": "$(prefix)"}))') .PHONY: install-python-bindings install-python-bindings: $(PYLIB) $(PYMOD)
Signature · 1 line
2.42.0
Re: [XEN PATCH v3 3/4] tools: don't use distutils in configure nor Makefile
Quoted 19 lines · Javi Merino
From: Marek Marczykowski-Górecki <[email protected]>
Python distutils is deprecated and is going to be removed in Python 3.12. distutils.sysconfig is available as the sysconfig module in stdlib since Python 2.7 and Python 3.2, so use that directly.
Update the README to reflect that we now depend on Python 2.7.
Regenerate configure after the m4/python_devel.m4 change.
Signed-off-by Marek Marczykowski-Górecki <[email protected]>Signed-off-by Javi Merino <[email protected]>--- README | 4 ++-- m4/python_devel.m4 | 28 +++++++++++----------- tools/configure | 52 ++++++++++++++++------------------------ tools/libs/stat/Makefile | 4 ++-- 4 files changed, 38 insertions(+), 50 deletions(-)
[...]
Quoted 90 lines
tools/configure +5
-17@@ -774,7 +774,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir@@ -905,7 +904,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'@@ -1158,15 +1156,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \@@ -1304,7 +1293,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes.@@ -1457,7 +1446,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]@@ -3397,7 +3385,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1];@@ -3443,7 +3431,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1];@@ -3467,7 +3455,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1];@@ -3512,7 +3500,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1];
tools/configure rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext · line 3530
Quoted 8 lines
tools/configure +1
-1@@ -3536,7 +3524,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1];
My copy of autoconf 2.69 generated these hunks that are not related to the changes in this patch. I have decided to keep the output of autoconf untouched for the patch, but I'm happy to remove them if it is unwanted noise.
Quoted 26 lines
tools/configure +7
-14@@ -7852,21 +7840,21 @@ fi if test x"$pyconfig" = x"no"; then : - CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print("-I" + distutils.sysconfig.get_config_var("INCLUDEPY"))'`" - CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("CFLAGS"))'`" - LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print("-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\ + CPPFLAGS="$CFLAGS `$PYTHON -c 'import sysconfig; \ + print("-I" + sysconfig.get_config_var("INCLUDEPY"))'`" + CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import sysconfig; \ + print(sysconfig.get_config_var("CFLAGS"))'`" + LDFLAGS="$LDFLAGS `$PYTHON -c 'import sysconfig; \ + print("-L" + sysconfig.get_python_lib(plat_specific=1,\ standard_lib=1) + "/config")'`" - LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("LINKFORSHARED"))'`" - LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("LDFLAGS"))'`" - LIBS="$LIBS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("LIBS"))'`" - LIBS="$LIBS `$PYTHON -c 'import distutils.sysconfig; \ - print(distutils.sysconfig.get_config_var("SYSLIBS"))'`" + LDFLAGS="$LDFLAGS `$PYTHON -c 'import sysconfig; \
tools/configure fi · line 7860
Quoted 10 lines
tools/configure +7
-0+ print(sysconfig.get_config_var("LINKFORSHARED"))'`" + LDFLAGS="$LDFLAGS `$PYTHON -c 'import sysconfig; \ + print(sysconfig.get_config_var("LDFLAGS"))'`" + LIBS="$LIBS `$PYTHON -c 'import sysconfig; \ + print(sysconfig.get_config_var("LIBS"))'`" + LIBS="$LIBS `$PYTHON -c 'import sysconfig; \ + print(sysconfig.get_config_var("SYSLIBS"))'`" else
Cheers,
Javi
PATCH v3 4/4 README: remove old note about the build system's python expectation
In reply to a message not in the archive5852ca485263 (build: fix tools/configure in case only python3 exists, 2019-12-11) changed the configure script to test for the availability of python3, python and python2 in that order. It sets PYTHON to the first one found in path. You don't need to have a symlink to python.
Remove the outdated note from the README.
--- README | 7 ------- 1 file changed, 7 deletions(-)
README +0 -7
@@ -184,13 +184,6 @@ Various tools, such as pygrub, have the following runtime dependencies: URL: https://www.python.org/ Debian: python -Note that the build system expects `python` to be available. If your system -only has `python2` or `python3` but not `python` (as in Linux From Scratch), -you will need to create a symlink for it, or specify PYTHON= when invoking -make, like (note the position of PYTHON= matters): - - # make PYTHON=/usr/bin/python3 - Intel(R) Trusted Execution Technology Support =============================================
Signature · 1 line
2.42.0
Re: [XEN PATCH v3 4/4] README: remove old note about the build system's python expectation
Quoted 6 lines · Javi Merino
5852ca485263(build: fixtools/configurein case only python3 exists, 2019-12-11) changed the configure script to test for the availability of python3, python and python2 in that order. It sets PYTHON to the first one found in path. You don't need to have a symlink to python.Remove the outdated note from the README.
But that note also covers the hypervisor build, which isn't affected by ./configure, and even less so by tools/configure.
Jan
Re: [XEN PATCH v3 4/4] README: remove old note about the build system's python expectation
Quoted 9 lines · Jan Beulich
Quoted 6 lines · Javi Merino
5852ca485263(build: fixtools/configurein case only python3 exists, 2019-12-11) changed the configure script to test for the availability of python3, python and python2 in that order. It sets PYTHON to the first one found in path. You don't need to have a symlink to python.Remove the outdated note from the README.
But that note also covers the hypervisor build, which isn't affected by ./configure, and even less so by
tools/configure.
The hypervisor build equally doesn't python= specifying.
~Andrew
Re: [XEN PATCH v3 4/4] README: remove old note about the build system's python expectation
Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Javi Merino
5852ca485263(build: fixtools/configurein case only python3 exists, 2019-12-11) changed the configure script to test for the availability of python3, python and python2 in that order. It sets PYTHON to the first one found in path. You don't need to have a symlink to python.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Remove the outdated note from the README.
But that note also covers the hypervisor build, which isn't affected by ./configure, and even less so by
tools/configure.The hypervisor build equally doesn't python= specifying.
I'm pretty sure that on at least one of my systems I need PYTHON=python3 when building the hypervisor.
Jan
Re: [XEN PATCH v3 4/4] README: remove old note about the build system's python expectation
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Javi Merino
5852ca485263(build: fixtools/configurein case only python3 exists, 2019-12-11) changed the configure script to test for the availability of python3, python and python2 in that order. It sets PYTHON to the first one found in path. You don't need to have a symlink to python.
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
Remove the outdated note from the README.
But that note also covers the hypervisor build, which isn't affected by ./configure, and even less so by
tools/configure.The hypervisor build equally doesn't python= specifying.
I'm pretty sure that on at least one of my systems I need PYTHON=python3 when building the hypervisor.
Not since c8a8645f1efe you haven't.
~Andrew