1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
https://github.com/bambocher/pocketsphinx-python/pull/77
commit 1575fe5938d049caa7fb13334cc17bdc816373fd
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Mon Sep 26 01:10:32 2022 +0200
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.
diff --git a/setup.py b/setup.py
index 466be08..4321fed 100644
--- a/setup.py
+++ b/setup.py
@@ -4,8 +4,6 @@ import sys
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 @@ except ImportError:
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
|