[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH v2 3/5] tools: don't use distutils in configure nor Makefile
On Tue, Sep 12, 2023 at 11:38:04AM +0100, Andrew Cooper wrote: > On 11/09/2023 5:51 pm, Javi Merino wrote: > > From: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx> > > > > Python distutils is deprecated and is going to be removed in Python > > 3.12. The distutils.sysconfig is available as sysconfig module in > > stdlib since Python 3.2, so use that directly. > > > > Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx> > > This breaks Py2, doesn't it? I was thinking that too, but "sysconfig" module seems to be in Python 2.7 too. > > --- > > m4/python_devel.m4 | 28 ++++++++++++++-------------- > > tools/libs/stat/Makefile | 4 ++-- > > 2 files changed, 16 insertions(+), 16 deletions(-) > > > > diff --git a/m4/python_devel.m4 b/m4/python_devel.m4 > > index bbf1e0354b..bb60857b03 100644 > > --- a/m4/python_devel.m4 > > +++ b/m4/python_devel.m4 > > @@ -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"))'`" > > I know the code was terrible to start with, but it's absurd to fork > multiple processes just to append different fields into the same variable. > > Why not have a config.py in this directory which takes > CPPFLAGS/LDFLAGS/LIBS as an input prints everything it needs. Then you > can repeat the import trick to prefer sysconfig and fall back to > distutils if sysconfig isn't available. > > ~Andrew -- Best Regards, Marek Marczykowski-Górecki Invisible Things Lab Attachment:
signature.asc
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |