Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/eselect-python:master commit in: /
Date: Tue, 23 Feb 2016 22:16:10
Message-Id: 1456177322.d462dcb4dc47e090b87b2947f0bacfee485c483e.mgorny@gentoo
1 commit: d462dcb4dc47e090b87b2947f0bacfee485c483e
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 22 21:32:14 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 22 21:42:02 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/eselect-python.git/commit/?id=d462dcb4
7
8 Obtain supported implementations list from python-exec2c
9
10 configure.ac | 2 --
11 python.eselect.in | 26 +++++++++-----------------
12 2 files changed, 9 insertions(+), 19 deletions(-)
13
14 diff --git a/configure.ac b/configure.ac
15 index 6ea1742..1e836e3 100644
16 --- a/configure.ac
17 +++ b/configure.ac
18 @@ -1,8 +1,6 @@
19 AC_INIT([eselect-python], [20160207])
20 AM_INIT_AUTOMAKE([-Wall foreign no-dist-gzip dist-bzip2])
21
22 -# note: we need AC_PROG_CC to determine EXEEXT (AC_EXEEXT does not work)
23 -AC_PROG_CC
24 AC_PATH_PROG(INSTALL, install)
25 AC_PROG_MKDIR_P
26
27
28 diff --git a/python.eselect.in b/python.eselect.in
29 index e9390ec..196140e 100644
30 --- a/python.eselect.in
31 +++ b/python.eselect.in
32 @@ -14,25 +14,17 @@ MAN_PATH="${EROOT%/}/usr/share/man/man1"
33 # Get list of all installed Python interpreters, in lexical order.
34 # $1 can be --pyN to filter results to pythonN.?.
35 get_installed_pythons() {
36 - local exes=(
37 - # note: order *matters*
38 - # TODO: get them outta python-exec
39 - "${INTERPRETER_DIR}"/jython?.?@EXEEXT@
40 - "${INTERPRETER_DIR}"/pypy{,3}@EXEEXT@
41 - "${INTERPRETER_DIR}"/python?.?@EXEEXT@
42 - )
43 -
44 local i
45 - for (( i = ${#exes[@]}-1; i >= 0; --i )); do
46 - local exe=${exes[i]}
47 - [[ -x ${exe} ]] || continue
48 - exe=${exe##*/}
49 - exe=${exe%@EXEEXT@}
50 - # apply filters
51 - [[ ${1} == --py* && ${exe} != python${1:4}* ]] && continue
52
53 - echo "${exe}"
54 - done
55 + # get complete list from python-exec
56 + while read i; do
57 + # filter by type
58 + [[ ${1} == --py* && ${i} != python${1:4}* ]] && continue
59 + # filter to installed only
60 + if type -P "${i}" &>/dev/null; then
61 + echo "${i}"
62 + fi
63 + done < <(python-exec2c -l)
64 }
65
66 # Get list of all preference values from python-exec.conf. This