aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/dist.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-09-04 19:09:42 -0400
committerJason R. Coombs <jaraco@jaraco.com>2016-09-04 19:09:42 -0400
commitd6efc9424328b42a3c7aeae758bab35bc7df5014 (patch)
treeef9071de6b6694904b7e3247bb03ac123cd5a0e5 /setuptools/dist.py
parent64b10c60755b6c7d70d178aeb7ff79ae9daf56bd (diff)
downloadexternal_python_setuptools-d6efc9424328b42a3c7aeae758bab35bc7df5014.tar.gz
external_python_setuptools-d6efc9424328b42a3c7aeae758bab35bc7df5014.tar.bz2
external_python_setuptools-d6efc9424328b42a3c7aeae758bab35bc7df5014.zip
Introduce a new monkey module to encapsulate the monkeypatching.
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r--setuptools/dist.py19
1 files changed, 2 insertions, 17 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 820df6d5..380b9436 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -9,7 +9,6 @@ import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
-from distutils.core import Distribution as _Distribution
from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
DistutilsSetupError)
from distutils.util import rfc822_escape
@@ -20,25 +19,11 @@ from pkg_resources.extern import packaging
from setuptools.depends import Require
from setuptools import windows_support
+from setuptools.monkey import _get_unpatched
import pkg_resources
-def _get_unpatched(cls):
- """Protect against re-patching the distutils if reloaded
-
- Also ensures that no other distutils extension monkeypatched the distutils
- first.
- """
- while cls.__module__.startswith('setuptools'):
- cls, = cls.__bases__
- if not cls.__module__.startswith('distutils'):
- raise AssertionError(
- "distutils has already been patched by %r" % cls
- )
- return cls
-
-
-_Distribution = _get_unpatched(_Distribution)
+_Distribution = _get_unpatched(distutils.core.Distribution)
def _patch_distribution_metadata_write_pkg_file():