From fb0bfad4641a146a5124315b32e4f229766a18c8 Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Fri, 31 Dec 2021 11:18:45 +0100 Subject: [PATCH] Fix RTD doc compilation https://github.com/aio-libs/aiokafka/pull/810 imports errors from `setuptools` instead of `distutils` This is available only starting from `setuptools` v59.0.0 (https://github.com/pypa/setuptools/pull/2858) but RTD currently defaults to v58.2.0 (https://docs.readthedocs.io/en/stable/builds.html#python) --- setup.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a89f6caa1..bf5d7417f 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,19 @@ from setuptools import Extension, setup from setuptools.command.bdist_rpm import bdist_rpm as _bdist_rpm from setuptools.command.build_ext import build_ext -from setuptools.errors import CCompilerError, ExecError, PlatformError + +try: + from setuptools.errors import CCompilerError, ExecError, PlatformError +except ImportError: + # RTD workaround until it ships setuptools>=v59.0.0 + # See: + # - https://github.com/pypa/setuptools/pull/2858 + # - https://docs.readthedocs.io/en/stable/builds.html#python + from distutils.errors import ( + CCompilerError, + DistutilsExecError as ExecError, + DistutilsPlatformError as PlatformError, + ) # Those are needed to build _hton for windows