From 1575fe5938d049caa7fb13334cc17bdc816373fd Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 26 Sep 2022 01:10:32 +0200 Subject: [PATCH] Fix build against setuptools 65 The newer setuptools warns: /usr/lib/python3/dist-packages/_distutils_hack/__init__.py:18: UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils. So we have to import setuptools before any distutils import. --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 466be08..4321fed 100644 --- a/setup.py +++ b/setup.py @@ -4,8 +4,6 @@ from shutil import copy, copytree, ignore_patterns from glob import glob -from distutils import log -from distutils.command.build import build as _build try: from setuptools import setup, Extension from setuptools.command.install import install as _install @@ -16,6 +14,9 @@ from distutils.command.install import install as _install from distutils.command.bdist_egg import bdist_egg as _bdist_egg +from distutils import log +from distutils.command.build import build as _build + if sys.platform.startswith('win'): from distutils.command.bdist_msi import bdist_msi as _bdist_msi from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst