diff options
| author | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-08-10 14:52:40 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-10 14:52:40 +0000 |
| commit | ccb4cb20d1fed12bbe8fd6c334036d9dfa67cd32 (patch) | |
| tree | b2cdedb6358e25e47673f894df2bd23b76c84fbb | |
| parent | 9d7b246c0f40fabb25741a023849bf14919e408d (diff) | |
| parent | 1410a8e6fda5fb8cd78f915e1ffd68f6c7f35af3 (diff) | |
| download | external_python_setuptools-ccb4cb20d1fed12bbe8fd6c334036d9dfa67cd32.tar.gz external_python_setuptools-ccb4cb20d1fed12bbe8fd6c334036d9dfa67cd32.tar.bz2 external_python_setuptools-ccb4cb20d1fed12bbe8fd6c334036d9dfa67cd32.zip | |
Merge pull request #2316 from pganssle/remove_warning
Fix issue with distutils warning
| -rw-r--r-- | _distutils_hack/__init__.py | 11 | ||||
| -rw-r--r-- | changelog.d/2316.change.rst | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index 71fa7ce1..1e7b294b 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -16,9 +16,12 @@ def warn_distutils_present(): # https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250 return warnings.warn( - "Distutils was imported before Setuptools. This usage is discouraged " - "and may exhibit undesirable behaviors or errors. Please use " - "Setuptools' objects directly or at least import Setuptools first.") + "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.") def clear_distutils(): @@ -56,8 +59,8 @@ def do_override(): See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 for more motivation. """ - warn_distutils_present() if enabled(): + warn_distutils_present() ensure_local_distutils() diff --git a/changelog.d/2316.change.rst b/changelog.d/2316.change.rst new file mode 100644 index 00000000..7d506b09 --- /dev/null +++ b/changelog.d/2316.change.rst @@ -0,0 +1 @@ +Removed warning when ``distutils`` is imported before ``setuptools`` when ``distutils`` replacement is not enabled. |
