Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH eselect-python 2/2] Re-set the same interpreters on 'update --if-unset'.
Date: Thu, 01 Nov 2012 11:54:11
Message-Id: 1351770893-1217-2-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-python] [PATCH eselect-python 1/2] Store per-version interpreter preference in a file as well. by "Michał Górny"
1 This will handle migrating/fixing user settings. In this particular
2 case, it's needed to write /etc/env.d/python/python* files on
3 eselect-python upgrade.
4 ---
5 python.eselect | 10 ++++++++--
6 1 file changed, 8 insertions(+), 2 deletions(-)
7
8 diff --git a/python.eselect b/python.eselect
9 index 8d4858a..f69d5df 100644
10 --- a/python.eselect
11 +++ b/python.eselect
12 @@ -382,10 +382,16 @@ do_update() {
13
14 if [[ "${if_unset}" == "1" && -f "${INTERPRETER_PATH}python" && -f "${ENV_D_PATH}/python/config" ]]; then
15 if [[ "${python2}" == "1" && -f "${INTERPRETER_PATH}python2" ]]; then
16 - return
17 + target="$(readlink "${INTERPRETER_PATH}python2")"
18 elif [[ "${python3}" == "1" && -f "${INTERPRETER_PATH}python3" ]]; then
19 - return
20 + target="$(readlink "${INTERPRETER_PATH}python3")"
21 elif [[ "${python2}" == "0" && "${python3}" == "0" ]]; then
22 + target="$(<"${ENV_D_PATH}/python/config")"
23 + fi
24 +
25 + if [[ ${target} ]]; then
26 + echo "Resetting ${target}"
27 + do_set ${python_version_option} ${target}
28 return
29 fi
30 fi
31 --
32 1.7.12.4