Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH python-utils-r1 1/4] Add python_is_python3().
Date: Wed, 21 Aug 2013 19:54:55
Message-Id: 1377114866-2669-1-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-python] [PATCHES] Initial python-utils-r1 changes for PyPy 2.1 by "Michał Górny"
1 To replace the checks with ones suitable for PyPy3.
2 ---
3 gx86/eclass/python-utils-r1.eclass | 14 ++++++++++++++
4 1 file changed, 14 insertions(+)
5
6 diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
7 index 5814a13..00399d2 100644
8 --- a/gx86/eclass/python-utils-r1.eclass
9 +++ b/gx86/eclass/python-utils-r1.eclass
10 @@ -942,5 +942,19 @@ __EOF__
11 fi
12 }
13
14 +# @FUNCTION: python_is_python3
15 +# @USAGE: [<impl>]
16 +# @DESCRIPTION:
17 +# Check whether <impl> (or ${EPYTHON}) is a Python3k variant
18 +# (i.e. uses syntax and stdlib of Python 3.*).
19 +#
20 +# Returns 0 (true) if it is, 1 (false) otherwise.
21 +python_is_python3() {
22 + local impl=${1:-${EPYTHON}}
23 + [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON"
24 +
25 + [[ ${impl} == python3* ]]
26 +}
27 +
28 _PYTHON_UTILS_R1=1
29 fi
30 --
31 1.8.3.2