Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 662422 - Default python should be changed automatically
Summary: Default python should be changed automatically
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-29 14:05 UTC by Dirkjan Ochtman (RETIRED)
Modified: 2023-05-01 15:52 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirkjan Ochtman (RETIRED) gentoo-dev 2018-07-29 14:05:10 UTC
I have a mostly-stable system with no explicit PYTHON_TARGETS. Over the weekend, I emerged world with --changed-use. Since uninstalled all libraries for the default Python (3.5) and reinstalled them for Python 3.6. After this, all my cron jobs started failing because of missing libraries.

This seems like a suboptimal way of handling these upgrades.
Comment 1 Mike Gilbert gentoo-dev 2018-07-29 16:25:16 UTC
Do you have a proposal for how this could be handled better? I'm not sure how we could figure out what the user actually wants.
Comment 2 Mike Gilbert gentoo-dev 2018-07-29 16:29:10 UTC
I think this is only an issue for scripts written/managed outside of portage.

Scripts that are installed using an ebuild would be installed in /usr/lib/python-exec/${EPYTHON}/, and the /usr/bin/python-exec wrapper will iterate over all installed python versions until it finds one that is valid for the script being executed.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-07-29 16:59:31 UTC
This should happen if you leave python-exec.conf blank.
Comment 4 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-07-29 19:11:16 UTC
If a new version of Python is installed because it is now in PYTHON_TARGETS and there are no other versions of Python (of the same major version -- I'm guessing this won't be exercised anytime soon if ever for anything other than 3.x) in PYTHON_TARGETS, then the new version should become the default as soon as it is installed. That probably still leaves a short window where it doesn't have libraries installed, but it definitely seems better than the current process.

And yes, I'm not talking about Portage-managed scripts; I have many little utility things that do things like scraping feeds or testing API availability.
Comment 5 Mike Gilbert gentoo-dev 2018-07-29 20:01:34 UTC
Maybe we could write a small ebuild that would have all python versions in PYTHON_COMPAT, and would simply make sure that the currently selected system python version is enabled in PYTHON_TARGETS.
Comment 6 Jack 2023-05-01 15:51:14 UTC
I'm curious if this is still relevant after the switch to python3_11 as default.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-01 15:52:03 UTC
(In reply to Jack from comment #6)
> I'm curious if this is still relevant after the switch to python3_11 as
> default.

I don't think so, especially given the python-exec change we made a few years ago to make "Python targets follow it" when we deprecated eselect-python.