1 |
hawking 08/05/29 14:10:48 |
2 |
|
3 |
Modified: python.eclass |
4 |
Log: |
5 |
python_mod_compile is now ROOT aware and can accept more than one files as argument. |
6 |
|
7 |
Revision Changes Path |
8 |
1.35 eclass/python.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.35&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.35&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.34&r2=1.35 |
13 |
|
14 |
Index: python.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v |
17 |
retrieving revision 1.34 |
18 |
retrieving revision 1.35 |
19 |
diff -u -r1.34 -r1.35 |
20 |
--- python.eclass 28 Mar 2008 07:11:57 -0000 1.34 |
21 |
+++ python.eclass 29 May 2008 14:10:48 -0000 1.35 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2008 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.34 2008/03/28 07:11:57 hawking Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.35 2008/05/29 14:10:48 hawking Exp $ |
27 |
|
28 |
# @ECLASS: python.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -124,15 +124,16 @@ |
31 |
} |
32 |
|
33 |
# @FUNCTION: python_mod_compile |
34 |
-# @USAGE: < file > |
35 |
+# @USAGE: < file > [more files ...] |
36 |
# @DESCRIPTION: |
37 |
-# Given a filename, it will pre-compile the module's .pyc and .pyo. |
38 |
+# Given filenames, it will pre-compile the module's .pyc and .pyo. |
39 |
# should only be run in pkg_postinst() |
40 |
# |
41 |
# Example: |
42 |
-# python_mod_compile ${ROOT}usr/lib/python2.3/site-packages/pygoogle.py |
43 |
+# python_mod_compile /usr/lib/python2.3/site-packages/pygoogle.py |
44 |
# |
45 |
python_mod_compile() { |
46 |
+ local f myroot |
47 |
# allow compiling for older python versions |
48 |
if [ -n "${PYTHON_OVERRIDE_PYVER}" ]; then |
49 |
PYVER=${PYTHON_OVERRIDE_PYVER} |
50 |
@@ -140,13 +141,19 @@ |
51 |
python_version |
52 |
fi |
53 |
|
54 |
- if [ -f "$1" ]; then |
55 |
- python${PYVER} -c "import py_compile; py_compile.compile('${1}')" || \ |
56 |
- ewarn "Failed to compile ${1}" |
57 |
- python${PYVER} -O -c "import py_compile; py_compile.compile('${1}')" || \ |
58 |
- ewarn "Failed to compile ${1}" |
59 |
+ # strip trailing slash |
60 |
+ myroot="${ROOT%/}" |
61 |
+ |
62 |
+ # respect ROOT |
63 |
+ for f in $@; do |
64 |
+ [ -f "${myroot}/${f}" ] && myfiles="${myfiles} ${myroot}/${f}" |
65 |
+ done |
66 |
+ |
67 |
+ if [ -n "${myfiles}" ]; then |
68 |
+ python${PYVER} ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py ${myfiles} |
69 |
+ python${PYVER} -O ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py ${myfiles} |
70 |
else |
71 |
- ewarn "Unable to find ${1}" |
72 |
+ ewarn "No files to compile!" |
73 |
fi |
74 |
} |
75 |
|
76 |
|
77 |
|
78 |
|
79 |
-- |
80 |
gentoo-commits@l.g.o mailing list |