aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-12-24 14:23:41 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-12-24 14:23:41 -0500
commitb7354452889c3eabc8717ac9c782eb288e788e85 (patch)
tree35e1b62a67806993f37ab80bc48a2b5e59de07b1
parentf1f9200d18fff71c5ec53e0269150da6858e51d6 (diff)
parent07a7b06dd8c6dc08c789505f263986e5f084f802 (diff)
downloadexternal_python_setuptools-b7354452889c3eabc8717ac9c782eb288e788e85.tar.gz
external_python_setuptools-b7354452889c3eabc8717ac9c782eb288e788e85.tar.bz2
external_python_setuptools-b7354452889c3eabc8717ac9c782eb288e788e85.zip
Merge branch 'issue-889'v32.3.0
-rw-r--r--setuptools/monkey.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/setuptools/monkey.py b/setuptools/monkey.py
index aabc280f..dbe9a617 100644
--- a/setuptools/monkey.py
+++ b/setuptools/monkey.py
@@ -7,6 +7,7 @@ import distutils.filelist
import platform
import types
import functools
+import inspect
from .py26compat import import_module
from setuptools.extern import six
@@ -35,12 +36,16 @@ def get_unpatched_class(cls):
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'):
+ external_bases = (
+ cls
+ for cls in inspect.getmro(cls)
+ if not cls.__module__.startswith('setuptools')
+ )
+ base = next(external_bases)
+ if not base.__module__.startswith('distutils'):
msg = "distutils has already been patched by %r" % cls
raise AssertionError(msg)
- return cls
+ return base
def patch_all():