From: "Michał Górny" <mgorny@gentoo.org> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/eselect-python:mgornys-hackery commit in: / Date: Thu, 12 Nov 2015 16:53:45 +0000 (UTC) [thread overview] Message-ID: <1447347217.a3421a53b669fd15c6449203700163712532e4f2.mgorny@gentoo> (raw) commit: a3421a53b669fd15c6449203700163712532e4f2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Thu Nov 12 16:40:08 2015 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Thu Nov 12 16:53:37 2015 +0000 URL: https://gitweb.gentoo.org/proj/eselect-python.git/commit/?id=a3421a53 Store selected python[23] version in a file Use /etc/env.d/python/python[23] file to store the active Python2/3 interpreter rather than /usr/bin/python[23] symlink target. This is simpler, more portable and allows us to replace symlinks with real wrappers. python.eselect.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python.eselect.in b/python.eselect.in index 8baa44e..32d9cbf 100644 --- a/python.eselect.in +++ b/python.eselect.in @@ -33,6 +33,13 @@ find_targets() { done } +set_python_subver() { + local target=${1} + local subver=${target%.*} + mkdir -p "${ENV_D_PATH}/python" + echo "${target}" > "${ENV_D_PATH}/python/${subver}" +} + set_python() { local symlink="${INTERPRETER_PATH}python" target="${1}" ln -s python-wrapper "${symlink}" @@ -119,6 +126,7 @@ set_scripts_and_symlinks() { pushd "${INTERPRETER_PATH}" 1> /dev/null ln -nfs "${target}" "${target%.*}" + set_python_subver "${target}" if [[ "${SET_MAIN_ACTIVE_PYTHON_INTERPRETER}" == "1" ]]; then set_python "${target}" set_python_config "${target/python/python-config-}" @@ -205,9 +213,9 @@ do_show() { fi if [[ "${python2}" == "1" ]]; then - interpreter="$(readlink "${INTERPRETER_PATH}python2")" + interpreter="$(<"${ENV_D_PATH}/python/python2")" elif [[ "${python3}" == "1" ]]; then - interpreter="$(readlink "${INTERPRETER_PATH}python3")" + interpreter="$(<"${ENV_D_PATH}/python/python3")" elif [[ -f "${ENV_D_PATH}/python/config" ]]; then interpreter="$(<"${ENV_D_PATH}/python/config")" fi
WARNING: multiple messages have this Message-ID (diff)
From: "Michał Górny" <mgorny@gentoo.org> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/eselect-python:master commit in: / Date: Tue, 17 Nov 2015 18:36:28 +0000 (UTC) [thread overview] Message-ID: <1447347217.a3421a53b669fd15c6449203700163712532e4f2.mgorny@gentoo> (raw) Message-ID: <20151117183628.1DwsdxWhG2TzCLHtYuJX7WnULW1GQJsVW88nt4TKCbM@z> (raw) commit: a3421a53b669fd15c6449203700163712532e4f2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Thu Nov 12 16:40:08 2015 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Thu Nov 12 16:53:37 2015 +0000 URL: https://gitweb.gentoo.org/proj/eselect-python.git/commit/?id=a3421a53 Store selected python[23] version in a file Use /etc/env.d/python/python[23] file to store the active Python2/3 interpreter rather than /usr/bin/python[23] symlink target. This is simpler, more portable and allows us to replace symlinks with real wrappers. python.eselect.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python.eselect.in b/python.eselect.in index 8baa44e..32d9cbf 100644 --- a/python.eselect.in +++ b/python.eselect.in @@ -33,6 +33,13 @@ find_targets() { done } +set_python_subver() { + local target=${1} + local subver=${target%.*} + mkdir -p "${ENV_D_PATH}/python" + echo "${target}" > "${ENV_D_PATH}/python/${subver}" +} + set_python() { local symlink="${INTERPRETER_PATH}python" target="${1}" ln -s python-wrapper "${symlink}" @@ -119,6 +126,7 @@ set_scripts_and_symlinks() { pushd "${INTERPRETER_PATH}" 1> /dev/null ln -nfs "${target}" "${target%.*}" + set_python_subver "${target}" if [[ "${SET_MAIN_ACTIVE_PYTHON_INTERPRETER}" == "1" ]]; then set_python "${target}" set_python_config "${target/python/python-config-}" @@ -205,9 +213,9 @@ do_show() { fi if [[ "${python2}" == "1" ]]; then - interpreter="$(readlink "${INTERPRETER_PATH}python2")" + interpreter="$(<"${ENV_D_PATH}/python/python2")" elif [[ "${python3}" == "1" ]]; then - interpreter="$(readlink "${INTERPRETER_PATH}python3")" + interpreter="$(<"${ENV_D_PATH}/python/python3")" elif [[ -f "${ENV_D_PATH}/python/config" ]]; then interpreter="$(<"${ENV_D_PATH}/python/config")" fi
next reply other threads:[~2015-11-12 16:53 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-11-12 16:53 Michał Górny [this message] 2015-11-17 18:36 ` [gentoo-commits] proj/eselect-python:master commit in: / Michał Górny -- strict thread matches above, loose matches on Subject: below -- 2015-11-12 17:07 [gentoo-commits] proj/eselect-python:mgornys-hackery " Michał Górny 2015-11-17 18:36 [gentoo-commits] proj/eselect-python:master " Michał Górny 2015-11-12 16:53 ` [gentoo-commits] proj/eselect-python:mgornys-hackery " Michał Górny 2015-11-17 18:36 [gentoo-commits] proj/eselect-python:master " Michał Górny 2015-11-17 12:59 ` [gentoo-commits] proj/eselect-python:mgornys-hackery " Michał Górny 2015-11-17 18:36 [gentoo-commits] proj/eselect-python:master " Michał Górny 2015-11-12 17:07 ` [gentoo-commits] proj/eselect-python:mgornys-hackery " Michał Górny
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1447347217.a3421a53b669fd15c6449203700163712532e4f2.mgorny@gentoo \ --to=mgorny@gentoo.org \ --cc=gentoo-commits@lists.gentoo.org \ --cc=gentoo-dev@lists.gentoo.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox