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

Diff of /eclass/python.eclass

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

Revision 1.50 Revision 1.53
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.50 2008/10/26 21:21:34 hawking Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.53 2008/10/27 12:23:50 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#
66# to protect sandbox. 66# to protect sandbox.
67# 67#
68# note: supported by >=dev-lang/python-2.2.3-r3 only. 68# note: supported by >=dev-lang/python-2.2.3-r3 only.
69# 69#
70python_disable_pyc() { 70python_disable_pyc() {
71 python_version
72 if [[ ${PYVER/./,} -ge 2,6 ]]; then
73 export PYTHONDONTWRITEBYTECODE=1 71 export PYTHONDONTWRITEBYTECODE=1 # For 2.6 and above
74 else 72 export PYTHON_DONTCOMPILE=1 # For 2.5 and below
75 export PYTHON_DONTCOMPILE=1
76 fi
77} 73}
78 74
79# @FUNCTION: python_enable_pyc 75# @FUNCTION: python_enable_pyc
80# @DESCRIPTION: 76# @DESCRIPTION:
81# Tells python to automatically recompile modules to .pyc/.pyo if the 77# Tells python to automatically recompile modules to .pyc/.pyo if the
82# timestamps/version stamps change 78# timestamps/version stamps change
83python_enable_pyc() { 79python_enable_pyc() {
80 unset PYTHONDONTWRITEBYTECODE
81 unset PYTHON_DONTCOMPILE
82}
83
84python_disable_pyc
85
86# @FUNCTION: python_need_rebuild
87# @DESCRIPTION: Run without arguments, specifies that the package should be
88# rebuilt after a python upgrade.
89python_need_rebuild() {
84 python_version 90 python_version
85 if [[ ${PYVER/./,} -ge 2,6 ]]; then 91 export PYTHON_NEED_REBUILD=${PYVER}
86 unset PYTHONDONTWRITEBYTECODE
87 else
88 unset PYTHON_DONTCOMPILE
89 fi
90} 92}
91
92python_disable_pyc
93 93
94# @FUNCTION: python_get_libdir 94# @FUNCTION: python_get_libdir
95# @DESCRIPTION: 95# @DESCRIPTION:
96# Run without arguments, returns the python library dir 96# Run without arguments, returns the python library dir
97python_get_libdir() { 97python_get_libdir() {
171 171
172 # strip trailing slash 172 # strip trailing slash
173 myroot="${ROOT%/}" 173 myroot="${ROOT%/}"
174 174
175 # respect ROOT 175 # respect ROOT
176 for f in $@; do 176 for f in "$@"; do
177 [[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}") 177 [[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}")
178 done 178 done
179 179
180 if ((${#myfiles[@]})); then 180 if ((${#myfiles[@]})); then
181 python${PYVER} ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py "${myfiles[@]}" 181 python${PYVER} ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py "${myfiles[@]}"

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20