~smoser/curtin/yakkety.lp1666986

« back to all changes in this revision

Viewing changes to bin/curtin

  • Committer: Scott Moser
  • Date: 2016-02-12 21:54:46 UTC
  • mto: (58.1.1 pkg)
  • mto: This revision was merged to the branch mainline in revision 39.
  • Revision ID: smoser@ubuntu.com-20160212215446-0h8ka36oznelsjz1
Tags: upstream-0.1.0~bzr351
ImportĀ upstreamĀ versionĀ 0.1.0~bzr351

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
PY3OR2_MCHECK="curtin.deps.check"
4
4
PY3OR2_PYTHONS=${PY3OR2_PYTHONS:-"python3:python"}
5
5
PYTHON=${PY3OR2_PYTHON}
 
6
PY3OR2_DEBUG=${PY3OR2_DEBUG:-0}
6
7
 
7
8
debug() {
8
 
   [ "${PY3OR2_DEBUG:-0}" != "0" ] || return 0
 
9
   [ "${PY3OR2_DEBUG}" != "0" ] || return 0
9
10
   echo "$@" 1>&2
10
11
}
11
12
fail() { echo "$@" 1>&2; exit 1; }
28
29
    oifs="$IFS"; IFS=":"
29
30
    best=0
30
31
    best_exe=""
 
32
    [ "${PY3OR2_DEBUG}" = "0" ] && _v="" || _v="-v"
31
33
    for p in $PY3OR2_PYTHONS; do
32
34
        command -v "$p" >/dev/null 2>&1 ||
33
35
            { debug "$p: not in path"; continue; }
34
36
        [ -z "$PY3OR2_MCHECK" ] && PYTHON=$p && break
35
 
        out=$($p -m "$PY3OR2_MCHECK" "$@" 2>&1) && PYTHON="$p" &&
36
 
            { debug "$p passed check [$p -m $PY3OR2_MCHECK $*]"; break; }
 
37
        out=$($p -m "$PY3OR2_MCHECK" $_v -- "$@" 2>&1) && PYTHON="$p" &&
 
38
            { debug "$p is good [$p -m $PY3OR2_MCHECK $_v -- $*]"; break; }
37
39
        ret=$?
38
40
        debug "$p [$ret]: $out"
39
41
        # exit code of 1 is unuseable