From 7ee01c7eeb7478a4a1f905c31422ab4fdfdca90d Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 27 Jan 2022 10:18:12 -0500 Subject: setup: Plan for newer setuptools providing distutils back compat setuptools still doesn't natively provide some infrastructure we need, but newer versions will keep 'import distutils' working until those issues are addressed. I think we need to reorder imports to take advantage of it though. It silences some deprecation warnings at least Signed-off-by: Cole Robinson --- setup.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index c1027606..e95acd39 100755 --- a/setup.py +++ b/setup.py @@ -17,16 +17,21 @@ import shutil import sysconfig import subprocess -# distutils will be deprecated in python 3.12 in favor of setuptools, -# but as of this writing there's standard no setuptools way to extend the -# 'build' or 'build_scripts' commands which are the only standard -# commands we trigger. -import distutils.command.build - import setuptools import setuptools.command.install import setuptools.command.install_egg_info + +# distutils will be deprecated in python 3.12 in favor of setuptools, +# but as of this writing there's standard no setuptools way to extend the +# 'build' commands which are the only standard commands we trigger. +# https://github.com/pypa/setuptools/issues/2591 +# +# Newer setuptools will transparently support 'import distutils' though. +# That can be overridden with SETUPTOOLS_USE_DISTUTILS env variable +import distutils.command.build # pylint: disable=wrong-import-order + + SYSPREFIX = sysconfig.get_config_var("prefix") -- cgit v1.2.1