Message11050

Author stefan.richthofer
Recipients jeff.allen, stefan.richthofer, wymannmi, zyasoft
Date 2017-02-01.01:12:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485911571.51.0.527107508977.issue2521@psf.upfronthosting.co.za>
In-reply-to
Content
Jython 2.7.0 bundeled this custom pip: https://github.com/jythontools/pip.
However nowadays the Jython-friendly implementation of __get_username disappeared there too. At some point after Jython 2.7.0 this specialized pip was removed, because upstream pip was believed to be suitable for Jython now (forgot to test on Windows?).
I tried to search in https://github.com/pypa/pip to see whether __get_username ever behaved Jython-friendly, but couldn't find it in the vast history. (Also remarkable: The pip bundled with Jython 2.7.0 describes itself as 1.6 while there never was a pip version with that number.) Anyway, based on this I suppose we shouldn't go for option 1) exclusively.

>I also fervently wish sys.platform were not as it is in Jython.

This was a constant pain in JyNI as well. E.g. native ctypes uses os.name for platform-check, and presenting it with 'java' wasn't quite helpful^^ There I solved this by monkeypatching sys.platform (and os.name) once JyNI is loaded. I insert a custom PyString subclass (PyShadowString) that displays like "java", but having __eq__ accept the current platform string as well (the one stored in os._name). So on linux you would have
print sys.platform result in 'java'
while sys.platform == 'posix' still yields True.
This manipulation could somewhat break Jython's startup, which I fixed in
https://github.com/jythontools/jython/commit/92c51dcd0aa9151f0c5a374474baccc8fe662c99
Before that fix I applied the monkeypatching after startup, but that was a bit ugly.

Hope this explains option 2) a bit better.

As far as I know in Jython 3 repo this stuff (os.name, sys.platform, what else?) was aligned with CPython behavior again. So hopefully such problems will find their end there.
History
Date User Action Args
2017-02-01 01:12:51stefan.richthofersetmessageid: <1485911571.51.0.527107508977.issue2521@psf.upfronthosting.co.za>
2017-02-01 01:12:51stefan.richthofersetrecipients: + stefan.richthofer, zyasoft, jeff.allen, wymannmi
2017-02-01 01:12:51stefan.richthoferlinkissue2521 messages
2017-02-01 01:12:50stefan.richthofercreate