From b9de5ca24d108b33f03b46bc82471609af28fc56 Mon Sep 17 00:00:00 2001 From: Pyrox Date: Fri, 19 Jul 2024 14:19:04 -0400 Subject: [PATCH] lib: py: remove distutils in favor of setuptools As distutils is removed in python 3.12, and setuptools provides the same interface, it can be switched in place with minor changes. This allows using the thrift bindings on versions of Python 3.12 or greater. --- lib/py/setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/py/setup.py b/lib/py/setup.py index 31e2bae326e..81d4621c60b 100644 --- a/lib/py/setup.py +++ b/lib/py/setup.py @@ -25,8 +25,8 @@ except Exception: from distutils.core import setup, Extension -from distutils.command.build_ext import build_ext -from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError +from setuptools.command.build_ext import build_ext +from setuptools.errors import CCompilerError, ExecError, PlatformError # Fix to build sdist under vagrant import os @@ -41,7 +41,7 @@ include_dirs.append('compat/win32') ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError, IOError) else: - ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) + ext_errors = (CCompilerError, ExecError, PlatformError) class BuildFailed(Exception): @@ -52,7 +52,7 @@ class ve_build_ext(build_ext): def run(self): try: build_ext.run(self) - except DistutilsPlatformError: + except PlatformError: raise BuildFailed() def build_extension(self, ext):