aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/setuptools/py3/_distutils_hack
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-07-25 22:24:09 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-07-25 22:32:20 +0300
commit9b5ec0cdb8b0d5accdbbae8203a8d21f92d2d790 (patch)
treecea9de21a912a049ded0e6918f80f93493fe03b9 /contrib/python/setuptools/py3/_distutils_hack
parent790f370a8a0bea0631222fd07a2ff26a8536d58a (diff)
downloadydb-9b5ec0cdb8b0d5accdbbae8203a8d21f92d2d790.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/python/setuptools/py3/_distutils_hack')
-rw-r--r--contrib/python/setuptools/py3/_distutils_hack/__init__.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/contrib/python/setuptools/py3/_distutils_hack/__init__.py b/contrib/python/setuptools/py3/_distutils_hack/__init__.py
index 4d3f09b0ae..35ab5cad49 100644
--- a/contrib/python/setuptools/py3/_distutils_hack/__init__.py
+++ b/contrib/python/setuptools/py3/_distutils_hack/__init__.py
@@ -3,6 +3,12 @@ import sys
import os
+report_url = (
+ "https://github.com/pypa/setuptools/issues/new?"
+ "template=distutils-deprecation.yml"
+)
+
+
def warn_distutils_present():
if 'distutils' not in sys.modules:
return
@@ -23,7 +29,12 @@ def clear_distutils():
return
import warnings
- warnings.warn("Setuptools is replacing distutils.")
+ warnings.warn(
+ "Setuptools is replacing distutils. Support for replacing "
+ "an already imported distutils is deprecated. In the future, "
+ "this condition will fail. "
+ f"Register concerns at {report_url}"
+ )
mods = [
name
for name in sys.modules
@@ -38,6 +49,16 @@ def enabled():
Allow selection of distutils by environment variable.
"""
which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local')
+ if which == 'stdlib':
+ import warnings
+
+ warnings.warn(
+ "Reliance on distutils from stdlib is deprecated. Users "
+ "must rely on setuptools to provide the distutils module. "
+ "Avoid importing distutils or import setuptools first, "
+ "and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib. "
+ f"Register concerns at {report_url}"
+ )
return which == 'local'