diff options
author | Michał Górny <mgorny@gentoo.org> | 2016-02-22 22:32:14 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2016-02-22 22:42:02 +0100 |
commit | d462dcb4dc47e090b87b2947f0bacfee485c483e (patch) | |
tree | c73c1d344aa2a28a468117364397761b14a64030 | |
parent | list: Use a more readable (verbose) output format (diff) | |
download | eselect-python-d462dcb4dc47e090b87b2947f0bacfee485c483e.tar.gz eselect-python-d462dcb4dc47e090b87b2947f0bacfee485c483e.tar.bz2 eselect-python-d462dcb4dc47e090b87b2947f0bacfee485c483e.zip |
Obtain supported implementations list from python-exec2c
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | python.eselect.in | 26 |
2 files changed, 9 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac index 6ea1742..1e836e3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,6 @@ AC_INIT([eselect-python], [20160207]) AM_INIT_AUTOMAKE([-Wall foreign no-dist-gzip dist-bzip2]) -# note: we need AC_PROG_CC to determine EXEEXT (AC_EXEEXT does not work) -AC_PROG_CC AC_PATH_PROG(INSTALL, install) AC_PROG_MKDIR_P diff --git a/python.eselect.in b/python.eselect.in index e9390ec..196140e 100644 --- a/python.eselect.in +++ b/python.eselect.in @@ -14,25 +14,17 @@ MAN_PATH="${EROOT%/}/usr/share/man/man1" # Get list of all installed Python interpreters, in lexical order. # $1 can be --pyN to filter results to pythonN.?. get_installed_pythons() { - local exes=( - # note: order *matters* - # TODO: get them outta python-exec - "${INTERPRETER_DIR}"/jython?.?@EXEEXT@ - "${INTERPRETER_DIR}"/pypy{,3}@EXEEXT@ - "${INTERPRETER_DIR}"/python?.?@EXEEXT@ - ) - local i - for (( i = ${#exes[@]}-1; i >= 0; --i )); do - local exe=${exes[i]} - [[ -x ${exe} ]] || continue - exe=${exe##*/} - exe=${exe%@EXEEXT@} - # apply filters - [[ ${1} == --py* && ${exe} != python${1:4}* ]] && continue - echo "${exe}" - done + # get complete list from python-exec + while read i; do + # filter by type + [[ ${1} == --py* && ${i} != python${1:4}* ]] && continue + # filter to installed only + if type -P "${i}" &>/dev/null; then + echo "${i}" + fi + done < <(python-exec2c -l) } # Get list of all preference values from python-exec.conf. This |