Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 416145 - app-eselect/eselect-python: Suggest value for PYTHON_TARGETS when changing default python interpreter
Summary: app-eselect/eselect-python: Suggest value for PYTHON_TARGETS when changing de...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-15 20:41 UTC by Mike Gilbert
Modified: 2018-04-20 21:49 UTC (History)
2 users (show)

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


Attachments
python.eselect-python_targets.patch (python.eselect-python_targets.patch,1.59 KB, patch)
2012-05-21 17:19 UTC, Krzysztof Pawlik (RETIRED)
Details | Diff
python.eselect-python_targets.patch (python.eselect-python_targets.patch,1.83 KB, patch)
2012-05-27 10:24 UTC, Krzysztof Pawlik (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Gilbert gentoo-dev 2012-05-15 20:41:22 UTC
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.
Comment 1 Dirkjan Ochtman (RETIRED) gentoo-dev 2012-05-15 20:47:21 UTC
+1.
Comment 2 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-15 20:57:14 UTC
+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').
Comment 3 Derk W te Bokkel 2012-05-15 22:13:30 UTC
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.
Comment 4 Mike Gilbert gentoo-dev 2012-05-16 00:29:28 UTC
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.
Comment 5 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-16 17:05:48 UTC
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?
Comment 6 Mike Gilbert gentoo-dev 2012-05-16 19:17:43 UTC
(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.
Comment 7 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-21 17:19:28 UTC
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 :)
Comment 8 Mike Gilbert gentoo-dev 2012-05-25 15:21:08 UTC
(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.
Comment 9 Krzysztof Pawlik (RETIRED) gentoo-dev 2012-05-27 10:24:44 UTC
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.
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-04-20 21:49:33 UTC
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.