Commit b7354452 authored by Jason R. Coombs's avatar Jason R. Coombs

Merge branch 'issue-889'

parents f1f9200d 07a7b06d
...@@ -7,6 +7,7 @@ import distutils.filelist ...@@ -7,6 +7,7 @@ import distutils.filelist
import platform import platform
import types import types
import functools import functools
import inspect
from .py26compat import import_module from .py26compat import import_module
from setuptools.extern import six from setuptools.extern import six
...@@ -35,12 +36,16 @@ def get_unpatched_class(cls): ...@@ -35,12 +36,16 @@ def get_unpatched_class(cls):
Also ensures that no other distutils extension monkeypatched the distutils Also ensures that no other distutils extension monkeypatched the distutils
first. first.
""" """
while cls.__module__.startswith('setuptools'): external_bases = (
cls, = cls.__bases__ cls
if not cls.__module__.startswith('distutils'): 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 msg = "distutils has already been patched by %r" % cls
raise AssertionError(msg) raise AssertionError(msg)
return cls return base
def patch_all(): def patch_all():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment