Gentoo Archives: gentoo-commits

From: "Michal Gorny (mgorny)" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog python-utils-r1.eclass
Date: Wed, 28 Aug 2013 22:04:24
Message-Id: 20130828220416.BC0CD2004C@flycatcher.gentoo.org
1 mgorny 13/08/28 22:04:16
2
3 Modified: ChangeLog python-utils-r1.eclass
4 Log:
5 Introduce python_is_python3() to replace the common checks.
6
7 Revision Changes Path
8 1.941 eclass/ChangeLog
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.941&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.941&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.940&r2=1.941
13
14 Index: ChangeLog
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
17 retrieving revision 1.940
18 retrieving revision 1.941
19 diff -u -r1.940 -r1.941
20 --- ChangeLog 28 Aug 2013 21:28:33 -0000 1.940
21 +++ ChangeLog 28 Aug 2013 22:04:16 -0000 1.941
22 @@ -1,6 +1,9 @@
23 # ChangeLog for eclass directory
24 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.940 2013/08/28 21:28:33 tomwij Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.941 2013/08/28 22:04:16 mgorny Exp $
27 +
28 + 28 Aug 2013; Michał Górny <mgorny@g.o> python-utils-r1.eclass:
29 + Introduce python_is_python3() to replace the common checks.
30
31 28 Aug 2013; Tom Wijsman <TomWij@g.o> ant-tasks.eclass:
32 Made ant-tasks.eclass support newer versions of the 1.9 branch.
33
34
35
36 1.31 eclass/python-utils-r1.eclass
37
38 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.31&view=markup
39 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.31&content-type=text/plain
40 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?r1=1.30&r2=1.31
41
42 Index: python-utils-r1.eclass
43 ===================================================================
44 RCS file: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v
45 retrieving revision 1.30
46 retrieving revision 1.31
47 diff -u -r1.30 -r1.31
48 --- python-utils-r1.eclass 27 Jul 2013 11:17:44 -0000 1.30
49 +++ python-utils-r1.eclass 28 Aug 2013 22:04:16 -0000 1.31
50 @@ -1,6 +1,6 @@
51 # Copyright 1999-2013 Gentoo Foundation
52 # Distributed under the terms of the GNU General Public License v2
53 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.30 2013/07/27 11:17:44 mgorny Exp $
54 +# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.31 2013/08/28 22:04:16 mgorny Exp $
55
56 # @ECLASS: python-utils-r1
57 # @MAINTAINER:
58 @@ -532,8 +532,8 @@
59 die "${FUNCNAME}: ${f} does not seem to have a valid shebang"
60 fi
61
62 - if [[ ${from} == python2 && ${impl} == python3*
63 - || ${from} == python3 && ${impl} != python3* ]]; then
64 + if { [[ ${from} == python2 ]] && python_is_python3 "${impl}"; } \
65 + || { [[ ${from} == python3 ]] && ! python_is_python3 "${impl}"; } then
66 eerror "A file does have shebang not supporting requested impl:"
67 eerror " file: ${f}"
68 eerror " shebang: ${shebang}"
69 @@ -883,9 +883,9 @@
70 python_export "${impl}" EPYTHON PYTHON
71
72 local pyver
73 - if [[ ${EPYTHON} == python3* ]]; then
74 + if python_is_python3; then
75 pyver=3
76 - else # includes pypy & jython
77 + else
78 pyver=2
79 fi
80
81 @@ -942,5 +942,19 @@
82 fi
83 }
84
85 +# @FUNCTION: python_is_python3
86 +# @USAGE: [<impl>]
87 +# @DESCRIPTION:
88 +# Check whether <impl> (or ${EPYTHON}) is a Python3k variant
89 +# (i.e. uses syntax and stdlib of Python 3.*).
90 +#
91 +# Returns 0 (true) if it is, 1 (false) otherwise.
92 +python_is_python3() {
93 + local impl=${1:-${EPYTHON}}
94 + [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON"
95 +
96 + [[ ${impl} == python3* ]]
97 +}
98 +
99 _PYTHON_UTILS_R1=1
100 fi