summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Polatel <hawking@gentoo.org>2008-10-26 17:11:51 +0000
committerAli Polatel <hawking@gentoo.org>2008-10-26 17:11:51 +0000
commit31204f040a16c3d036497af44ecea5063428ae76 (patch)
tree3b74719b02a6af03fc5c6ebd61e3f6739a9fe110 /eclass/python.eclass
parentadd ~x86 (diff)
downloadgentoo-2-31204f040a16c3d036497af44ecea5063428ae76.tar.gz
gentoo-2-31204f040a16c3d036497af44ecea5063428ae76.tar.bz2
gentoo-2-31204f040a16c3d036497af44ecea5063428ae76.zip
Use PYTHONDONTWRITEBYTECODE to {en,dis}able pyc for 2.6 and above.
Diffstat (limited to 'eclass/python.eclass')
-rw-r--r--eclass/python.eclass56
1 files changed, 33 insertions, 23 deletions
diff --git a/eclass/python.eclass b/eclass/python.eclass
index 72f5888891de..5968ff25eeb2 100644
--- a/eclass/python.eclass
+++ b/eclass/python.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.45 2008/09/01 14:11:54 hawking Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.46 2008/10/26 17:11:51 hawking Exp $
# @ECLASS: python.eclass
# @MAINTAINER:
@@ -36,28 +36,6 @@ __python_eclass_test() {
echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO"
}
-# @FUNCTION: python_disable_pyc
-# @DESCRIPTION:
-# Tells python not to automatically recompile modules to .pyc/.pyo
-# even if the timestamps/version stamps don't match. This is done
-# to protect sandbox.
-#
-# note: supported by >=dev-lang/python-2.2.3-r3 only.
-#
-python_disable_pyc() {
- export PYTHON_DONTCOMPILE=1
-}
-
-# @FUNCTION: python_enable_pyc
-# @DESCRIPTION:
-# Tells python to automatically recompile modules to .pyc/.pyo if the
-# timestamps/version stamps change
-python_enable_pyc() {
- unset PYTHON_DONTCOMPILE
-}
-
-python_disable_pyc
-
# @FUNCTION: python_version
# @DESCRIPTION:
# Run without arguments and it will export the version of python
@@ -81,6 +59,38 @@ python_version() {
__python_version_extract $PYVER_ALL
}
+# @FUNCTION: python_disable_pyc
+# @DESCRIPTION:
+# Tells python not to automatically recompile modules to .pyc/.pyo
+# even if the timestamps/version stamps don't match. This is done
+# to protect sandbox.
+#
+# note: supported by >=dev-lang/python-2.2.3-r3 only.
+#
+python_disable_pyc() {
+ python_version
+ if [[ ${PYVER/./,} -ge 2,6 ]]; then
+ export PYTHONDONTWRITEBYTECODE=1
+ else
+ export PYTHON_DONTCOMPILE=1
+ fi
+}
+
+# @FUNCTION: python_enable_pyc
+# @DESCRIPTION:
+# Tells python to automatically recompile modules to .pyc/.pyo if the
+# timestamps/version stamps change
+python_enable_pyc() {
+ python_version
+ if [[ ${PYVER/./,} -ge 2,6 ]]; then
+ unset PYTHONDONTWRITEBYTECODE
+ else
+ unset PYTHON_DONTCOMPILE
+ fi
+}
+
+python_disable_pyc
+
# @FUNCTION: python_get_libdir
# @DESCRIPTION:
# Run without arguments, returns the python library dir