1 |
arfrever 09/09/09 04:16:58 |
2 |
|
3 |
Modified: python.eclass |
4 |
Log: |
5 |
Add support for '--' option in some functions. Ensure that appropriate Python version is installed in validate_PYTHON_ABIS(). Add support for '--no-link' option in python_copy_sources(). |
6 |
|
7 |
Revision Changes Path |
8 |
1.71 eclass/python.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.71&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.71&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.70&r2=1.71 |
13 |
|
14 |
Index: python.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v |
17 |
retrieving revision 1.70 |
18 |
retrieving revision 1.71 |
19 |
diff -u -r1.70 -r1.71 |
20 |
--- python.eclass 5 Sep 2009 17:30:08 -0000 1.70 |
21 |
+++ python.eclass 9 Sep 2009 04:16:58 -0000 1.71 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2009 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.70 2009/09/05 17:30:08 arfrever Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.71 2009/09/09 04:16:58 arfrever Exp $ |
27 |
|
28 |
# @ECLASS: python.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -68,7 +68,7 @@ |
31 |
} |
32 |
|
33 |
# @FUNCTION: PYTHON |
34 |
-# @USAGE: [-a|--absolute-path] <Python_ABI="${PYTHON_ABI}"> |
35 |
+# @USAGE: [-a|--absolute-path] [--] <Python_ABI="${PYTHON_ABI}"> |
36 |
# @DESCRIPTION: |
37 |
# Get Python interpreter filename for specified Python ABI. If Python_ABI argument |
38 |
# is ommitted, then PYTHON_ABI environment variable must be set and is used. |
39 |
@@ -80,6 +80,9 @@ |
40 |
-a|--absolute-path) |
41 |
absolute_path="1" |
42 |
;; |
43 |
+ --) |
44 |
+ break |
45 |
+ ;; |
46 |
-*) |
47 |
die "${FUNCNAME}(): Unrecognized option $1" |
48 |
;; |
49 |
@@ -167,9 +170,14 @@ |
50 |
fi |
51 |
fi |
52 |
|
53 |
- # Ensure that EPYTHON variable is respected. |
54 |
local PYTHON_ABI |
55 |
for PYTHON_ABI in ${PYTHON_ABIS}; do |
56 |
+ # Ensure that appropriate Python version is installed. |
57 |
+ if ! has_version "dev-lang/python:${PYTHON_ABI}"; then |
58 |
+ die "dev-lang/python:${PYTHON_ABI} isn't installed" |
59 |
+ fi |
60 |
+ |
61 |
+ # Ensure that EPYTHON variable is respected. |
62 |
if [[ "$(EPYTHON="$(PYTHON)" python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" != "${PYTHON_ABI}" ]]; then |
63 |
die "'python' doesn't respect EPYTHON variable" |
64 |
fi |
65 |
@@ -177,11 +185,29 @@ |
66 |
} |
67 |
|
68 |
# @FUNCTION: python_copy_sources |
69 |
-# @USAGE: [directory] |
70 |
+# @USAGE: [--no-link] [--] [directory] |
71 |
# @DESCRIPTION: |
72 |
# Copy unpacked sources of given package for each Python ABI. |
73 |
python_copy_sources() { |
74 |
- local dir dirs=() PYTHON_ABI |
75 |
+ local dir dirs=() no_link="0" PYTHON_ABI |
76 |
+ |
77 |
+ while (($#)); do |
78 |
+ case "$1" in |
79 |
+ --no-link) |
80 |
+ no_link="1" |
81 |
+ ;; |
82 |
+ --) |
83 |
+ break |
84 |
+ ;; |
85 |
+ -*) |
86 |
+ die "${FUNCNAME}(): Unrecognized option '$1'" |
87 |
+ ;; |
88 |
+ *) |
89 |
+ break |
90 |
+ ;; |
91 |
+ esac |
92 |
+ shift |
93 |
+ done |
94 |
|
95 |
if [[ "$#" -eq "0" ]]; then |
96 |
if [[ "${WORKDIR}" == "${S}" ]]; then |
97 |
@@ -195,7 +221,11 @@ |
98 |
validate_PYTHON_ABIS |
99 |
for PYTHON_ABI in ${PYTHON_ABIS}; do |
100 |
for dir in "${dirs[@]}"; do |
101 |
- cp -lpr "${dir}" "${dir}-${PYTHON_ABI}" > /dev/null || die "Copying of sources failed" |
102 |
+ if [[ "${no_link}" == "1" ]]; then |
103 |
+ cp -pr "${dir}" "${dir}-${PYTHON_ABI}" > /dev/null || die "Copying of sources failed" |
104 |
+ else |
105 |
+ cp -lpr "${dir}" "${dir}-${PYTHON_ABI}" > /dev/null || die "Copying of sources failed" |
106 |
+ fi |
107 |
done |
108 |
done |
109 |
} |
110 |
@@ -216,7 +246,7 @@ |
111 |
} |
112 |
|
113 |
# @FUNCTION: python_execute_function |
114 |
-# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] <function> [arguments] |
115 |
+# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] [--] <function> [arguments] |
116 |
# @DESCRIPTION: |
117 |
# Execute specified function for each value of PYTHON_ABIS, optionally passing additional |
118 |
# arguments. The specified function can use PYTHON_ABI and BUILDDIR variables. |
119 |
@@ -245,6 +275,9 @@ |
120 |
-s|--separate-build-dirs) |
121 |
separate_build_dirs="1" |
122 |
;; |
123 |
+ --) |
124 |
+ break |
125 |
+ ;; |
126 |
-*) |
127 |
die "${FUNCNAME}(): Unrecognized option '$1'" |
128 |
;; |