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

[xen master] tools/python: convert setup.py to use setuptools if available



commit 9314a61936506dc4bd3779a5c7ba4706e2644aac
Author:     Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
AuthorDate: Tue Sep 19 07:30:27 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Sep 20 20:53:58 2023 +0100

    tools/python: convert setup.py to use setuptools if available
    
    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.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Javi Merino <javi.merino@xxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/pygrub/setup.py | 7 +++++--
 tools/python/setup.py | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/pygrub/setup.py b/tools/pygrub/setup.py
index 502aa4df2d..c9cac47eee 100644
--- a/tools/pygrub/setup.py
+++ b/tools/pygrub/setup.py
@@ -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
 
diff --git a/tools/python/setup.py b/tools/python/setup.py
index 721a3141d7..02354f6986 100644
--- a/tools/python/setup.py
+++ b/tools/python/setup.py
@@ -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 = "../.."
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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