As a follow up to bug 415575, I suggested that we alter the python eselect module to display a suggested value for PYTHON_TARGETS that the user may paste into make.conf.
+1.
+1 One enhancement I'd like to see is that if suggested value differs from current then show this information, otherwise stay silent (hint: `portageq envvar PYTHON_TARGETS').
if you are going to suggest to the user to cut and paste this in .. why not add an update to each python install for recommended additions to /etc/make.conf .. and have the user use etc-update or dispatch-update (sp?) them in place ? just my thoughts.
Modifying portage configuration gets messy because there are many different files that are assembled to produce the final config instance. I really don't think it is worth the effort.
Rough idea how it could work: 1. get a list of installed implementations (this would need to be synced with a list in eclass, maybe get the list from eclass itself?) 2. check which are installed -> generate new possible PYTHON_TARGETS 3. compare new PYTHON_TARGETS with the one from $(portageq envvar PYTHON_TARGETS) 4. if different: notify user Possible problems: - if python.eselect has its own list of implementation it can get out of sync with the one from eclass - portageq is portage specific, what about paludis & pkgcore users?
(In reply to comment #5) > Possible problems: > - if python.eselect has its own list of implementation it can get out of > sync with the one from eclass The current eselect module generates a list based on a loop like this: for interpreter in /usr/bin/python?.?; do # echo the basename done I think all we really need to do is translate the period to an underscore. eselect-python currently has no support for selecting pypy or jython, so we can ignore them. > - portageq is portage specific, what about paludis & pkgcore users? pinspect query env_var PYTHON_TARGETS seems to work for pkgcore. No idea on paludis.
Created attachment 312553 [details, diff] python.eselect-python_targets.patch I've implemented this functionality, could you take a look and tell me what you think? I'm checking for Jython and Pypy too :)
(In reply to comment #7) I just tested it locally, and it seems to work. Nice! I do think the message should give a brief explanation of where to define PYTHON_TARGETS, at least for portage. As a user, I would be left scratching my head.
Created attachment 313235 [details, diff] python.eselect-python_targets.patch (In reply to comment #8) > (In reply to comment #7) > > I just tested it locally, and it seems to work. Nice! Thank you :) > I do think the message should give a brief explanation of where to define > PYTHON_TARGETS, at least for portage. As a user, I would be left scratching > my head. Good point, I've added explanation just after PYTHON_TARGETS values, check attached patch. The only missing thing is support for Paludis.
Almost 6 years and it didn't happen, so it probably won't happen. Also, I don't think it fits in the current model where eselect-python is used rather rarely and PYTHON_TARGETS are controlled directly.