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

Diff of /eclass/python.eclass

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

Revision 1.35 Revision 1.36
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.35 2008/05/29 14:10:48 hawking Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.36 2008/05/29 15:24:35 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#
166# 166#
167# If supplied with arguments, it will recompile all modules recursively 167# If supplied with arguments, it will recompile all modules recursively
168# in the supplied directory 168# in the supplied directory
169# 169#
170# Example: 170# Example:
171# python_mod_optimize ${ROOT}usr/share/codegen 171# python_mod_optimize /usr/share/codegen
172python_mod_optimize() { 172python_mod_optimize() {
173 local myroot 173 local mydirs myfiles myroot path
174 # strip trailing slash 174 # strip trailing slash
175 myroot="${ROOT%/}" 175 myroot="${ROOT%/}"
176
177 # respect ROOT
178 for path in $@; do
179 [ ! -e "${myroot}/${path}" ] && ewarn "${myroot}/${path} doesn't exist!"
180 [ -d "${myroot}/${path#/}" ] && mydirs="${mydirs} ${myroot}/${path#/}"
181 # Files are passed to python_mod_compile which is ROOT-aware
182 [ -f "${myroot}/${path}" ] && myfiles="${myfiles} ${path}"
183 done
176 184
177 # allow compiling for older python versions 185 # allow compiling for older python versions
178 if [ -n "${PYTHON_OVERRIDE_PYVER}" ]; then 186 if [ -n "${PYTHON_OVERRIDE_PYVER}" ]; then
179 PYVER=${PYTHON_OVERRIDE_PYVER} 187 PYVER=${PYTHON_OVERRIDE_PYVER}
180 else 188 else
187 else 195 else
188 compileopts="-q" 196 compileopts="-q"
189 fi 197 fi
190 198
191 ebegin "Byte compiling python modules for python-${PYVER} .." 199 ebegin "Byte compiling python modules for python-${PYVER} .."
200 if [ -n "${mydirs}" ]; then
201 python${PYVER} \
192 python${PYVER} ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py ${compileopts} $@ 202 ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py \
203 ${compileopts} ${mydirs}
204 python${PYVER} -O \
193 python${PYVER} -O ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py ${compileopts} $@ 205 ${myroot}/usr/$(get_libdir)/python${PYVER}/compileall.py \
206 ${compileopts} ${mydirs}
207 fi
208
209 if [ -n "${myfiles}" ]; then
210 python_mod_compile ${myfiles}
211 fi
212
194 eend $? 213 eend $?
195} 214}
196 215
197# @FUNCTION: python_mod_cleanup 216# @FUNCTION: python_mod_cleanup
198# @USAGE: [ dir ] 217# @USAGE: [ dir ]

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.20