mirror of
https://github.com/openvswitch/ovs
synced 2025-10-29 15:28:56 +00:00
python: Use setuptools instead of distutils.
On Python 3.12, distutils will be removed and it's currently (3.10+) deprecated (see PEP 632). Since the suggested and simplest replacement is setuptools, this commit replaces distutils to use setuptools instead. setuptools < 59.0 doesn't have setuptools.errors and so, in this case, distutils.errors is still used. Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Acked-by: Mike Pattrick <mkp@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
47cfa89412
commit
6a9ec13aa3
@@ -13,9 +13,13 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from distutils.command.build_ext import build_ext
|
from setuptools.command.build_ext import build_ext
|
||||||
from distutils.errors import CCompilerError, DistutilsExecError, \
|
try:
|
||||||
DistutilsPlatformError
|
from setuptools.errors import CCompilerError, ExecError, PlatformError
|
||||||
|
except ImportError: # Needed for setuptools < 59.0
|
||||||
|
from distutils.errors import CCompilerError
|
||||||
|
from distutils.errors import DistutilsExecError as ExecError
|
||||||
|
from distutils.errors import DistutilsPlatformError as PlatformError
|
||||||
|
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
@@ -38,7 +42,7 @@ except IOError:
|
|||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
|
ext_errors = (CCompilerError, ExecError, PlatformError)
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
ext_errors += (IOError, ValueError)
|
ext_errors += (IOError, ValueError)
|
||||||
|
|
||||||
@@ -54,7 +58,7 @@ class try_build_ext(build_ext):
|
|||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
build_ext.run(self)
|
build_ext.run(self)
|
||||||
except DistutilsPlatformError:
|
except PlatformError:
|
||||||
raise BuildFailed()
|
raise BuildFailed()
|
||||||
|
|
||||||
def build_extension(self, ext):
|
def build_extension(self, ext):
|
||||||
|
|||||||
Reference in New Issue
Block a user