diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-12-27 02:29:05 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-12-27 02:29:05 +0000 |
commit | d27e1bd3f1f239e59cbbab70fecd7b1ca28727da (patch) | |
tree | 9e53b48a1c6c0878e796f1ff234d656c26726ab1 | |
parent | Don't use ASFLAGS. (diff) | |
download | eselect-python-d27e1bd3f1f239e59cbbab70fecd7b1ca28727da.tar.gz eselect-python-d27e1bd3f1f239e59cbbab70fecd7b1ca28727da.tar.bz2 eselect-python-d27e1bd3f1f239e59cbbab70fecd7b1ca28727da.zip |
Support `eselect python show --ABI`.
-rw-r--r-- | python.eselect | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/python.eselect b/python.eselect index 8556a68..7f11590 100644 --- a/python.eselect +++ b/python.eselect @@ -152,14 +152,18 @@ describe_show() { } describe_show_options() { + echo "--ABI : Show Python ABI in format of PYTHON_ABI variable" echo "--python2 : Show active Python 2 interpreter" echo "--python3 : Show active Python 3 interpreter" } do_show() { - local python2="0" python3="0" + local ABI="0" interpreter python2="0" python3="0" while [[ $# > 0 ]]; do case "$1" in + --ABI) + ABI="1" + ;; --python2) python2="1" ;; @@ -178,11 +182,17 @@ do_show() { fi if [[ "${python2}" == "1" ]]; then - readlink "${INTERPRETER_PATH}python2" + interpreter="$(readlink "${INTERPRETER_PATH}python2")" elif [[ "${python3}" == "1" ]]; then - readlink "${INTERPRETER_PATH}python3" + interpreter="$(readlink "${INTERPRETER_PATH}python3")" elif [[ -f "${ENV_D_PATH}/python/config" ]]; then - cat "${ENV_D_PATH}/python/config" + interpreter="$(<"${ENV_D_PATH}/python/config")" + fi + + if [[ "${ABI}" == "1" ]]; then + echo "${interpreter#python}" + else + echo "${interpreter}" fi } |