Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 503874 - distutils-r1.eclass should use --install-lib for correct target libdir
Summary: distutils-r1.eclass should use --install-lib for correct target libdir
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords: PATCH
: 680194 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-03-08 14:32 UTC by James Le Cuirot
Modified: 2019-03-15 10:29 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
distutils-r1-install-lib.patch (distutils-r1-install-lib.patch,408 bytes, patch)
2014-03-08 14:32 UTC, James Le Cuirot
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Le Cuirot gentoo-dev 2014-03-08 14:32:57 UTC
Created attachment 372082 [details, diff]
distutils-r1-install-lib.patch

Python sucks at cross-compiling. We all know this. I'm not proposing to fix the cross-compiling of native modules, I'll leave that to upstream, but we can at least install modules to the correct lib directory. This will mean that non-native modules install correctly.

I am building on amd64 for arm and my modules install to ${ROOT}/usr/lib64/pythonX.X, which obviously isn't right. The --install-lib flag is all that's needed to fix this. See the very simple attached patch.

I checked the tree for ebuilds for that already give --install-lib.

 * app-accessibility/sphinx3 doesn't use this eclass.
 * games-action/slune and games-strategy/outerspace pass $(python_get_sitedir) like the patch does.
 * games-engines/renpy passes $(python_get_sitedir)/renpy${MYSLOT} but this takes precedence over the previous value so no problem.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-05-19 04:11:27 UTC
As you already know, Python sucks a lot. So now, you need to check for side effects. In other words, make sure that passing --install-lib won't break random stuff, e.g. by disabling some files or moving them around. I'm a bit afraid there are some packages that may set some defaults for this, and those defaults would get overriden by the eclass.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-05-19 04:23:43 UTC
And just to be clear, I'm saying that because things like this used to happen with various stuff passed by the eclass. That's why we set build-purelib & build-platlib separately. That's why most of the directory overrides are set weakly via .pydistutils.cfg and not passed via command-line.

In fact, I'm not sure if we still need to pass --root= explicitly since we set it in .cfg anyway. Maybe I missed removing the explicit option. Maybe it had some side effects ;).

So who's working on a tinderbox again?
Comment 3 James Le Cuirot gentoo-dev 2016-10-02 21:07:47 UTC
Unfortunately even using this locally no longer works since fd4001e9682ed11db9f6b2cf87f3e89ed291fe02 when you stopped hardcoding PYTHON_SITEDIR. :(
Comment 4 James Le Cuirot gentoo-dev 2016-10-02 21:27:53 UTC
For what it's worth, this gives me the right answer for CPython but it's probably no good for the others, especially since it depends on sysconfig, which you said cannot be used. :(

realpath -ms $(PYTHONPATH="${EROOT}usr/lib/${impl}" "${PYTHON}" -c 'import site; print(site.getsitepackages()[0])')
Comment 5 James Le Cuirot gentoo-dev 2016-10-05 20:53:24 UTC
Actually I didn't think to try the same trick with the distutils snippet you already have. It does work.

realpath -ms $(PYTHONPATH="${EROOT}"usr/$(get_libdir)/${impl} "${PYTHON}"  -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')

I'll find out whether it works for non-CPython. The only crappy part is adjusting PYTHONPATH for jython.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-02-27 10:22:44 UTC
Feel free to reopen when you have a patch or a clear idea how to proceed here.
Comment 7 James Le Cuirot gentoo-dev 2019-03-15 10:29:14 UTC
*** Bug 680194 has been marked as a duplicate of this bug. ***