/[gentoo-x86]/eclass/python.eclass
Gentoo

Diff of /eclass/python.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.39 Revision 1.41
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.39 2008/05/29 21:19:19 hawking Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.41 2008/05/30 09:58:28 hawking Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# python@gentoo.org 7# python@gentoo.org
8# 8#
176# Options passed to this function are passed to compileall.py 176# Options passed to this function are passed to compileall.py
177# 177#
178# Example: 178# Example:
179# python_mod_optimize /usr/share/codegen 179# python_mod_optimize /usr/share/codegen
180python_mod_optimize() { 180python_mod_optimize() {
181 local mydirs myfiles myroot myopts path 181 local mydirs myfiles myroot myopts
182 182
183 # Check if phase is pkg_postinst() 183 # Check if phase is pkg_postinst()
184 [[ ${EBUILD_PHASE} != postinst ]] &&\ 184 [[ ${EBUILD_PHASE} != postinst ]] &&\
185 die "${FUNCNAME} should only be run in pkg_postinst()" 185 die "${FUNCNAME} should only be run in pkg_postinst()"
186 186
192 case $1 in 192 case $1 in
193 -l|-f|-q) 193 -l|-f|-q)
194 myopts="${myopts} $1" 194 myopts="${myopts} $1"
195 ;; 195 ;;
196 -d|-x) 196 -d|-x)
197 # -x takes regexp as argument so quoting is necessary.
198 myopts="${myopts} $1 \"$2\"" 197 myopts="${myopts} $1 $2"
199 shift 198 shift
200 ;; 199 ;;
201 -*) 200 -*)
202 ewarn "${FUNCNAME}: Ignoring compile option $1" 201 ewarn "${FUNCNAME}: Ignoring compile option $1"
203 ;; 202 ;;
204 *) 203 *)
205 for path in $@; do
206 [ ! -e "${myroot}/${path}" ] && ewarn "${myroot}/${path} doesn't exist!" 204 [ ! -e "${myroot}/${1}" ] && ewarn "${myroot}/${1} doesn't exist!"
207 [ -d "${myroot}/${path#/}" ] && mydirs="${mydirs} ${myroot}/${path#/}" 205 [ -d "${myroot}/${1#/}" ] && mydirs="${mydirs} ${myroot}/${1#/}"
208 # Files are passed to python_mod_compile which is ROOT-aware 206 # Files are passed to python_mod_compile which is ROOT-aware
209 [ -f "${myroot}/${path}" ] && myfiles="${myfiles} ${path}" 207 [ -f "${myroot}/${1}" ] && myfiles="${myfiles} ${1}"
210 done
211 ;; 208 ;;
212 esac 209 esac
213 shift 210 shift
214 done 211 done
215 212
218 PYVER=${PYTHON_OVERRIDE_PYVER} 215 PYVER=${PYTHON_OVERRIDE_PYVER}
219 else 216 else
220 python_version 217 python_version
221 fi 218 fi
222 219
223 # set opts 220 # set additional opts
224 if [ "${PYVER}" = "2.2" ]; then 221 myopts="${myopts} -q"
225 compileopts=""
226 else
227 compileopts="-q"
228 fi
229 222
230 ebegin "Byte compiling python modules for python-${PYVER} .." 223 ebegin "Byte compiling python modules for python-${PYVER} .."
231 if [ -n "${mydirs}" ]; then 224 if [ -n "${mydirs}" ]; then
232 python${PYVER} \ 225 python${PYVER} \
233 ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py \ 226 ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py \
234 ${compileopts} ${myopts} ${mydirs} 227 ${myopts} ${mydirs}
235 python${PYVER} -O \ 228 python${PYVER} -O \
236 ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py \ 229 ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py \
237 ${compileopts} ${myopts} ${mydirs} 230 ${myopts} ${mydirs}
238 fi 231 fi
239 232
240 if [ -n "${myfiles}" ]; then 233 if [ -n "${myfiles}" ]; then
241 python_mod_compile ${myfiles} 234 python_mod_compile ${myfiles}
242 fi 235 fi

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.41

  ViewVC Help
Powered by ViewVC 1.1.20