[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v2 2/5] tools: convert setup.py to use setuptools



On Tue, Sep 12, 2023 at 11:22:56AM +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. Migrate to 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 C extension.
> >
> > Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
> 
> Throughout the commit message, s/use/support/ seeing as we're not
> removing distutils.

Ok.

> Next, this needs a SoB from you because you've changed the patch from
> what Marek originally wrote.

Done

> > diff --git a/tools/pygrub/setup.py b/tools/pygrub/setup.py
> > index 502aa4df2d..f9e8feb2e6 100644
> > --- a/tools/pygrub/setup.py
> > +++ b/tools/pygrub/setup.py
> > @@ -1,5 +1,9 @@
> > -from distutils.core import setup, Extension
> > -from distutils.ccompiler import new_compiler
> > +try:
> > +    from setuptools import setup, Extension
> > +except ImportError:
> > +    # distutils was removed in Python 3.12.  If this import fails,
> > +    # install setuptools.
> > +    from distutils.core import setup, Extension
> 
> Finally, this feels a little unnecessary.  How about just:
> 
> # Prefer setuptools, fall back to distutils
> try:
>     from setuptools import setup, Extension
> except ImportError:
>     from distutils.core import setup, Extension

Done



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.