Gentoo Archives: gentoo-commits

From: "Ali Polatel (hawking)" <hawking@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: python.eclass
Date: Thu, 29 May 2008 21:19:26
Message-Id: E1K1pWq-0001ht-4D@stork.gentoo.org
1 hawking 08/05/29 21:19:20
2
3 Modified: python.eclass
4 Log:
5 Pass options given to python_mod_optimize to compileall.py ,thanks to Remy Blank, #224137. Fixed typos.
6
7 Revision Changes Path
8 1.39 eclass/python.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.39&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.39&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.38&r2=1.39
13
14 Index: python.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v
17 retrieving revision 1.38
18 retrieving revision 1.39
19 diff -u -r1.38 -r1.39
20 --- python.eclass 29 May 2008 20:01:55 -0000 1.38
21 +++ python.eclass 29 May 2008 21:19:19 -0000 1.39
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.38 2008/05/29 20:01:55 hawking Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.39 2008/05/29 21:19:19 hawking Exp $
27
28 # @ECLASS: python.eclass
29 # @MAINTAINER:
30 @@ -137,7 +137,7 @@
31
32 # Check if phase is pkg_postinst()
33 [[ ${EBUILD_PHASE} != postinst ]] &&\
34 - die "${FUNCNAME} should only be run in pkg_postinst()"
35 + die "${FUNCNAME} should only be run in pkg_postinst()"
36
37 # allow compiling for older python versions
38 if [ -n "${PYTHON_OVERRIDE_PYVER}" ]; then
39 @@ -173,24 +173,44 @@
40 # in the supplied directory
41 # This function should only be run in pkg_postinst()
42 #
43 +# Options passed to this function are passed to compileall.py
44 +#
45 # Example:
46 # python_mod_optimize /usr/share/codegen
47 python_mod_optimize() {
48 - local mydirs myfiles myroot path
49 + local mydirs myfiles myroot myopts path
50
51 # Check if phase is pkg_postinst()
52 [[ ${EBUILD_PHASE} != postinst ]] &&\
53 - die "${FUNCNAME} should only be run in pkg_postinst()"
54 + die "${FUNCNAME} should only be run in pkg_postinst()"
55
56 # strip trailing slash
57 myroot="${ROOT%/}"
58
59 - # respect ROOT
60 - for path in $@; do
61 - [ ! -e "${myroot}/${path}" ] && ewarn "${myroot}/${path} doesn't exist!"
62 - [ -d "${myroot}/${path#/}" ] && mydirs="${mydirs} ${myroot}/${path#/}"
63 - # Files are passed to python_mod_compile which is ROOT-aware
64 - [ -f "${myroot}/${path}" ] && myfiles="${myfiles} ${path}"
65 + # respect ROOT and options passed to compileall.py
66 + while [ $# -gt 0 ]; do
67 + case $1 in
68 + -l|-f|-q)
69 + myopts="${myopts} $1"
70 + ;;
71 + -d|-x)
72 + # -x takes regexp as argument so quoting is necessary.
73 + myopts="${myopts} $1 \"$2\""
74 + shift
75 + ;;
76 + -*)
77 + ewarn "${FUNCNAME}: Ignoring compile option $1"
78 + ;;
79 + *)
80 + for path in $@; do
81 + [ ! -e "${myroot}/${path}" ] && ewarn "${myroot}/${path} doesn't exist!"
82 + [ -d "${myroot}/${path#/}" ] && mydirs="${mydirs} ${myroot}/${path#/}"
83 + # Files are passed to python_mod_compile which is ROOT-aware
84 + [ -f "${myroot}/${path}" ] && myfiles="${myfiles} ${path}"
85 + done
86 + ;;
87 + esac
88 + shift
89 done
90
91 # allow compiling for older python versions
92 @@ -211,10 +231,10 @@
93 if [ -n "${mydirs}" ]; then
94 python${PYVER} \
95 ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py \
96 - ${compileopts} ${mydirs}
97 + ${compileopts} ${myopts} ${mydirs}
98 python${PYVER} -O \
99 ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py \
100 - ${compileopts} ${mydirs}
101 + ${compileopts} ${myopts} ${mydirs}
102 fi
103
104 if [ -n "${myfiles}" ]; then
105 @@ -240,7 +260,7 @@
106
107 # Check if phase is pkg_postrm()
108 [[ ${EBUILD_PHASE} != postrm ]] &&\
109 - die "${FUNCNAME} should only be run in pkg_postrm()"
110 + die "${FUNCNAME} should only be run in pkg_postrm()"
111
112 # strip trailing slash
113 myroot="${ROOT%/}"
114
115
116
117 --
118 gentoo-commits@l.g.o mailing list