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-r1.eclass
Date: Mon, 29 Oct 2012 09:25:15
Message-Id: 20121029092504.49F7621600@flycatcher.gentoo.org
1 mgorny 12/10/29 09:25:04
2
3 Modified: ChangeLog python-r1.eclass
4 Log:
5 Introduce python_export_best() to obtain variables for the most preferred Python implementation enabled.
6
7 Revision Changes Path
8 1.476 eclass/ChangeLog
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.476&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.476&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.475&r2=1.476
13
14 Index: ChangeLog
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
17 retrieving revision 1.475
18 retrieving revision 1.476
19 diff -u -r1.475 -r1.476
20 --- ChangeLog 29 Oct 2012 09:23:58 -0000 1.475
21 +++ ChangeLog 29 Oct 2012 09:25:04 -0000 1.476
22 @@ -1,6 +1,10 @@
23 # ChangeLog for eclass directory
24 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.475 2012/10/29 09:23:58 mgorny Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.476 2012/10/29 09:25:04 mgorny Exp $
27 +
28 + 29 Oct 2012; Michał Górny <mgorny@g.o> python-r1.eclass:
29 + Introduce python_export_best() to obtain variables for the most preferred
30 + Python implementation enabled.
31
32 29 Oct 2012; Michał Górny <mgorny@g.o> python-r1.eclass:
33 Add getters for common Python variables.
34
35
36
37 1.10 eclass/python-r1.eclass
38
39 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.10&view=markup
40 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.10&content-type=text/plain
41 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.9&r2=1.10
42
43 Index: python-r1.eclass
44 ===================================================================
45 RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v
46 retrieving revision 1.9
47 retrieving revision 1.10
48 diff -u -r1.9 -r1.10
49 --- python-r1.eclass 29 Oct 2012 09:23:58 -0000 1.9
50 +++ python-r1.eclass 29 Oct 2012 09:25:04 -0000 1.10
51 @@ -1,6 +1,6 @@
52 # Copyright 1999-2012 Gentoo Foundation
53 # Distributed under the terms of the GNU General Public License v2
54 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.9 2012/10/29 09:23:58 mgorny Exp $
55 +# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.10 2012/10/29 09:25:04 mgorny Exp $
56
57 # @ECLASS: python-r1
58 # @MAINTAINER:
59 @@ -387,3 +387,28 @@
60 fi
61 done
62 }
63 +
64 +# @FUNCTION: python_export_best
65 +# @USAGE: [<variable>...]
66 +# @DESCRIPTION:
67 +# Find the best (most preferred) Python implementation enabled
68 +# and export given variables for it. If no variables are provided,
69 +# EPYTHON & PYTHON will be exported.
70 +python_export_best() {
71 + debug-print-function ${FUNCNAME} "${@}"
72 +
73 + [[ ${#} -gt 0 ]] || set -- EPYTHON PYTHON
74 +
75 + local impl best
76 + for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
77 + if has "${impl}" "${PYTHON_COMPAT[@]}" && use "python_targets_${impl}"
78 + then
79 + best=${impl}
80 + fi
81 + done
82 +
83 + [[ ${best+1} ]] || die "python_export_best(): no implementation found!"
84 +
85 + debug-print "${FUNCNAME}: Best implementation is: ${impl}"
86 + python_export "${impl}" "${@}"
87 +}