python-distutils-ng compiles bytecode in src_install(). That seems a little incorrect. Can't we just enable distutils bytecode compilation and let it do it in src_compile()?
Actually, distutils does not generate the bytecode files until you run the "install" step. For some unknown reason, we are passing --no-compile in src_install. # @FUNCTION: _python-distutils-ng_default_distutils_install # @DESCRIPTION: # Default src_install for distutils-based packages. _python-distutils-ng_default_distutils_install() { "${PYTHON}" setup.py install --no-compile --root="${D}/" || die } Why are we doing that?
Created attachment 310643 [details, diff] python-distutils-ng.eclass-compilation.diff Main reason is quite simple: previous eclass had this split, so I've modeled exactly that behavior. Another good reason is that you need to vary arguments passed to setup.py depending on Python implementation (Jython doesn't do optimizations for example). I'm attaching a patch that simplifies the eclass (yay!) by re-enabling module compilation in default src_install and removing (now) useless code. Can anybody test this with Pypy? (I'll attach xlrd ebuild that I'm using for tests as next attachment).
Created attachment 310645 [details] xlrd-0.7.7-r256.ebuild
Works for me with pypy-1.8. pypy seems to silently ignore the -O2 flag. Do we actually need that case statement? Does jython throw an error or something? Also, while we are modifying this piece of code, can we pass root as the following? --root="${D%/}/" This avoids passing duplicate trailing slashes, which is a pet-peeve of mine.
(In reply to comment #4) > pypy seems to silently ignore the -O2 flag. Actually, pypy ignores -OO, which is what distutils passes to it when you do setup.py install -O2.
Created attachment 310661 [details, diff] python-distutils-ng.eclass-compilation.diff Thank you Mike for testing with Pypy. Yes, Jython shows ugly error message when it gets -OO, if Pypy just ignores it then it's ok and I've removed it from case statement. I've modified --root too. Please review and I'll commit the change.
Looks good to me.
(In reply to comment #7) > Looks good to me. Thank you for the review, committed.