Gentoo Archives: gentoo-commits

From: "Dirkjan Ochtman (djc)" <djc@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: python.eclass
Date: Mon, 04 Jul 2011 11:27:38
Message-Id: 20110704112729.285E82004B@flycatcher.gentoo.org
1 djc 11/07/04 11:27:29
2
3 Modified: python.eclass
4 Log:
5 Support Python ABI patterns list in _python_check_python_abi_matching.
6 (Patch by Arfrever. Backported from python overlay.)
7
8 Revision Changes Path
9 1.115 eclass/python.eclass
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python.eclass?rev=1.115&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python.eclass?rev=1.115&content-type=text/plain
13 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python.eclass?r1=1.114&r2=1.115
14
15 Index: python.eclass
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v
18 retrieving revision 1.114
19 retrieving revision 1.115
20 diff -u -r1.114 -r1.115
21 --- python.eclass 4 Jul 2011 11:00:52 -0000 1.114
22 +++ python.eclass 4 Jul 2011 11:27:29 -0000 1.115
23 @@ -1,6 +1,6 @@
24 # Copyright 1999-2011 Gentoo Foundation
25 # Distributed under the terms of the GNU General Public License v2
26 -# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.114 2011/07/04 11:00:52 djc Exp $
27 +# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.115 2011/07/04 11:27:29 djc Exp $
28
29 # @ECLASS: python.eclass
30 # @MAINTAINER:
31 @@ -25,22 +25,59 @@
32 # ================================================================================================
33
34 _python_check_python_abi_matching() {
35 + local pattern patterns patterns_list="0" PYTHON_ABI
36 +
37 + while (($#)); do
38 + case "$1" in
39 + --patterns-list)
40 + patterns_list="1"
41 + ;;
42 + --)
43 + shift
44 + break
45 + ;;
46 + -*)
47 + die "${FUNCNAME}(): Unrecognized option '$1'"
48 + ;;
49 + *)
50 + break
51 + ;;
52 + esac
53 + shift
54 + done
55 +
56 if [[ "$#" -ne 2 ]]; then
57 die "${FUNCNAME}() requires 2 arguments"
58 fi
59
60 - if [[ "$2" == *"-cpython" ]]; then
61 - [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "$1" == ${2%-cpython} ]]
62 - elif [[ "$2" == *"-jython" ]]; then
63 - [[ "$1" == $2 ]]
64 - else
65 - if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
66 - [[ "$1" == $2 ]]
67 - elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
68 - [[ "${1%-jython}" == $2 ]]
69 - else
70 - die "${FUNCNAME}(): Unrecognized Python ABI '$1'"
71 + PYTHON_ABI="$1"
72 +
73 + if [[ "${patterns_list}" == "0" ]]; then
74 + pattern="$2"
75 +
76 + if [[ "${pattern}" == *"-cpython" ]]; then
77 + [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "${PYTHON_ABI}" == ${pattern%-cpython} ]]
78 + elif [[ "${pattern}" == *"-jython" ]]; then
79 + [[ "${PYTHON_ABI}" == ${pattern} ]]
80 + else
81 + if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
82 + [[ "${PYTHON_ABI}" == ${pattern} ]]
83 + elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
84 + [[ "${PYTHON_ABI%-jython}" == ${pattern} ]]
85 + else
86 + die "${FUNCNAME}(): Unrecognized Python ABI '${PYTHON_ABI}'"
87 + fi
88 fi
89 + else
90 + patterns="${2// /$'\n'}"
91 +
92 + while read pattern; do
93 + if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
94 + return 0
95 + fi
96 + done <<< "${patterns}"
97 +
98 + return 1
99 fi
100 }