-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setuptools + pbr broken on Jython 2.7.0 #1024
Comments
That change was made intentionally to address #889. Can you debug in the Jython environment and determine where the behavior goes awry? Is it that |
Given a virtualenv with Jython 2.7.0 and these dependencies:
I changed the method to this: def get_unpatched_class(cls):
"""Protect against re-patching the distutils if reloaded
Also ensures that no other distutils extension monkeypatched the distutils
first.
"""
print("MRO")
print(inspect.getmro(cls))
print("Bases")
print(cls.__bases__)
external_bases = (
cls
for cls in inspect.getmro(cls)
if not cls.__module__.startswith('setuptools')
)
print("external_bases")
print(external_bases)
print("---")
base = next(external_bases)
if not base.__module__.startswith('distutils'):
msg = "distutils has already been patched by %r" % cls
raise AssertionError(msg)
return base Which produced this output when calling
When doing the same on Python 3.4, this is the output:
|
Some more data, when checking how Jython handles def get_unpatched_class(cls):
"""Protect against re-patching the distutils if reloaded
Also ensures that no other distutils extension monkeypatched the distutils
first.
"""
print("MRO")
print(inspect.getmro(cls))
print("Bases")
print(cls.__bases__)
external_bases = []
for cls in inspect.getmro(cls):
print(cls.__module__)
if not cls.__module__.startswith('setuptools'):
external_bases.append(cls)
print("external_bases")
print(external_bases)
print("---")
base = next(iter(external_bases))
if not base.__module__.startswith('distutils'):
msg = "distutils has already been patched by %r" % cls
raise AssertionError(msg)
return base Which produces on Jython:
And on Python 3.4:
It does seem that |
Changing the method to this seems to fix the issue by sidestepping def get_unpatched_class(cls):
"""Protect against re-patching the distutils if reloaded
Also ensures that no other distutils extension monkeypatched the distutils
first.
"""
external_bases = (
cls
for cls in (cls,) + cls.__bases__
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 base I'm not sure if this introduces any other issues. If this is an acceptable solution, I can prepare a pull request for you. |
I don't understand why I'm disinclined to accept the workaround you've provided because |
I've figured it out - it's a bug/limitation of Jython. The issue appears to be that because both
It outputs
Run it on CPython and you'll see multiple Y classes.
|
I've [filed an issue upstream]. At this point, I'll welcome a patch per my guidelines above. |
Jython seems to implement inspect.getmro differently, which causes any classes with the same name as a class lower in the MRO not to be returned. This patch offloads the MRO lookup to a separate function, which implements different logic for Jython only. Ref pypa#1024
I'm running into an issue using a combination of setuptools and pbr on Jython, that produces this error:
All versions
>= 32.3.0
are affected, which leads me to believe that this change introduced the bug.Steps to reproduce:
/path/to/jython/bin/pip install -U pip setuptools virtualenv
setuptools+pbr+jython-bug
./path/to/jython/bin/virtualenv env
and enter it.python setup.py install
will produce the error.pip install setuptools==32.0.0
.python setup.py install
works as expected.The text was updated successfully, but these errors were encountered: