From df012710b1609d5d2c67540913e37ce6d9a7a1ba Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 30 Dec 2020 07:07:12 +0900 Subject: [PATCH] Imported Upstream version 49.1.2 --- .bumpversion.cfg | 2 +- CHANGES.rst | 6 ++++++ setup.cfg | 2 +- setuptools/__init__.py | 2 +- setuptools/distutils_patch.py | 12 +++++++++++- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 55f806f..30e83be 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 49.1.1 +current_version = 49.1.2 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index d5a2a70..24837a9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v49.1.2 +------- + +* #2232: In preparation for re-enabling a local copy of distutils, Setuptools now honors an environment variable, SETUPTOOLS_USE_DISTUTILS. If set to 'stdlib' (current default), distutils will be used from the standard library. If set to 'local' (default in a imminent backward-incompatible release), the local copy of distutils will be used. + + v49.1.1 ------- diff --git a/setup.cfg b/setup.cfg index 3151fa4..dc29f7b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ formats = zip [metadata] name = setuptools -version = 49.1.1 +version = 49.1.2 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org diff --git a/setuptools/__init__.py b/setuptools/__init__.py index a6cbe13..8388251 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -4,7 +4,7 @@ import os import functools # Disabled for now due to: #2228, #2230 -# import setuptools.distutils_patch # noqa: F401 +import setuptools.distutils_patch # noqa: F401 import distutils.core import distutils.filelist diff --git a/setuptools/distutils_patch.py b/setuptools/distutils_patch.py index b2095fb..c5f273d 100644 --- a/setuptools/distutils_patch.py +++ b/setuptools/distutils_patch.py @@ -7,6 +7,7 @@ for more motivation. import sys import re +import os import importlib import warnings @@ -20,6 +21,14 @@ def clear_distutils(): del sys.modules[name] +def enabled(): + """ + Allow selection of distutils by environment variable. + """ + which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib') + return which == 'local' + + def ensure_local_distutils(): clear_distutils() distutils = importlib.import_module('setuptools._distutils') @@ -31,4 +40,5 @@ def ensure_local_distutils(): assert '_distutils' in core.__file__, core.__file__ -ensure_local_distutils() +if enabled(): + ensure_local_distutils() -- 2.34.1