aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/monkey.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-05-30 19:39:58 -0400
committerJason R. Coombs <jaraco@jaraco.com>2017-05-30 19:39:58 -0400
commitfcdf12ee7fdf43c9dded5b68232a0fb3376d4858 (patch)
tree29baaad1490dcce705ccc5f32c6d9d9240e1d10d /setuptools/monkey.py
parent3d0cc355fb5e8012cb8c72f0e25042a5a44f31d6 (diff)
parent4dc2c76b62a5071dfacf434555dfa8ec2be0b433 (diff)
downloadexternal_python_setuptools-fcdf12ee7fdf43c9dded5b68232a0fb3376d4858.tar.gz
external_python_setuptools-fcdf12ee7fdf43c9dded5b68232a0fb3376d4858.tar.bz2
external_python_setuptools-fcdf12ee7fdf43c9dded5b68232a0fb3376d4858.zip
Merge branch 'master' into feature/re-vendor-sadface
Diffstat (limited to 'setuptools/monkey.py')
-rw-r--r--setuptools/monkey.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/setuptools/monkey.py b/setuptools/monkey.py
index 94f22a56..6d3711ec 100644
--- a/setuptools/monkey.py
+++ b/setuptools/monkey.py
@@ -21,6 +21,20 @@ if you think you need this functionality.
"""
+def _get_mro(cls):
+ """
+ Returns the bases classes for cls sorted by the MRO.
+
+ Works around an issue on Jython where inspect.getmro will not return all
+ base classes if multiple classes share the same name. Instead, this
+ function will return a tuple containing the class itself, and the contents
+ of cls.__bases__. See https://github.com/pypa/setuptools/issues/1024.
+ """
+ if platform.python_implementation() == "Jython":
+ return (cls,) + cls.__bases__
+ return inspect.getmro(cls)
+
+
def get_unpatched(item):
lookup = (
get_unpatched_class if isinstance(item, six.class_types) else
@@ -38,7 +52,7 @@ def get_unpatched_class(cls):
"""
external_bases = (
cls
- for cls in inspect.getmro(cls)
+ for cls in _get_mro(cls)
if not cls.__module__.startswith('setuptools')
)
base = next(external_bases)