From d462dcb4dc47e090b87b2947f0bacfee485c483e Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Mon, 22 Feb 2016 22:32:14 +0100 Subject: Obtain supported implementations list from python-exec2c --- configure.ac | 2 -- 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 -- cgit v1.2.3-65-gdbad