With multiple pythons versions installed, removing of certain version leaves it present in eselect python list and in /etc/python-exec/python-exec.conf. Moreover it can be selected as active even the version is not present on box. Reproducible: Always w520 / # eselect python list Available Python interpreters, in order of preference: [1] python3.6 [2] python3.4 [3] python2.7 w520 / # w520 / # cat /etc/python-exec/python-exec.conf (clipped) ... python3.6 python3.4 python2.7 w520 / # ls -l /var/db/pkg/dev-lang (clipped) drwxr-xr-x 2 root root 4096 Oct 20 17:16 python-2.7.13 drwxr-xr-x 2 root root 4096 Oct 28 15:09 python-3.4.6 drwxr-xr-x 2 root root 4096 Oct 20 17:18 python-3.6.1-r1 drwxr-xr-x 2 root root 4096 Apr 5 2017 python-exec-2.4.5 w520 / # emerge -C python:3.4 * This action can remove important packages! In order to be safer, use * `emerge -pv --depclean <atom>` to check for reverse dependencies before * removing packages. dev-lang/python selected: 3.4.6 protected: none omitted: 2.7.13 3.6.1-r1 After removal of pytohn:3.4: w520 / # eselect python list Available Python interpreters, in order of preference: [1] python3.6 [2] python3.4 [3] python2.7 w520 / # Same with python-exec.conf entries, all three versions are present. I can select non-existent python: w520 / # eselect python set 2 w520 / # eselect python list Available Python interpreters, in order of preference: [1] python3.4 [2] python3.6 [3] python2.7 w520 / #
I see two things to potentially fix here: 1. We should mark the entries for uninstalled Pythons appropriately to reduce confusion. 2. It may be reasonable to remove old entries from python.exec in pkg_postrm() when the last version in slot is removed. Comments?
i prefer #2 (or any viable way which does the same) as this eliminate any possible confusion with pythons entries. No python:slot exist on box -no eselect entries should be on the box too.
I would prefer not to mess with the config file in pkg_* functions. We should treat it like a typical config file whenever possible, and let the sysadmin maintain its contents.
https://gitweb.gentoo.org/proj/eselect-python.git/commit/?id=a818ba77f72aff31d82badf7cb9b4cbd50cdbdf2 Added a new 'cleanup' action there. I will do a new release later, then we'll decide whether we want to run by default.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74abdf6f536ff8713ebb520db2e484808c7c041b commit 74abdf6f536ff8713ebb520db2e484808c7c041b Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2017-12-04 17:44:14 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2017-12-04 17:47:30 +0000 app-eselect/eselect-python: Bump to 20171204 Bug: https://bugs.gentoo.org/635678 Closes: https://bugs.gentoo.org/639578 app-eselect/eselect-python/Manifest | 1 + .../eselect-python/eselect-python-20171204.ebuild | 40 ++++++++++++++++++++++ 2 files changed, 41 insertions(+)}
I experienced the same problem after upgrading to dev-lang/python:3.5 and it was resolved by the updated app-eselect/eselect-python. However, I still have another file referencing the old removed Python 3.4 # cat /etc/env.d/python/config python3.4 What do I do with this?
I think those we should remove in postinst() when upgrading. @floppym, your opinion?
(In reply to Michał Górny from comment #7) /etc/env.d/python/config doesn't get used in any of our tools, right? Cleaning it up seems ok, but ultimately unnecessary.