[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN PATCH v2 2/5] tools: convert setup.py to use setuptools
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> --- tools/pygrub/setup.py | 8 ++++++-- tools/python/setup.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) 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 import os import sys diff --git a/tools/python/setup.py b/tools/python/setup.py index 721a3141d7..e8111bd098 100644 --- a/tools/python/setup.py +++ b/tools/python/setup.py @@ -1,5 +1,9 @@ - -from distutils.core import setup, Extension +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 import os, sys XEN_ROOT = "../.." -- 2.41.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |