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: Sun, 26 Oct 2008 17:11:55
Message-Id: E1Ku99b-0001XU-PW@stork.gentoo.org
1 hawking 08/10/26 17:11:51
2
3 Modified: python.eclass
4 Log:
5 Use PYTHONDONTWRITEBYTECODE to {en,dis}able pyc for 2.6 and above.
6
7 Revision Changes Path
8 1.46 eclass/python.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.46&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.46&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.45&r2=1.46
13
14 Index: python.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v
17 retrieving revision 1.45
18 retrieving revision 1.46
19 diff -u -r1.45 -r1.46
20 --- python.eclass 1 Sep 2008 14:11:54 -0000 1.45
21 +++ python.eclass 26 Oct 2008 17:11:51 -0000 1.46
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.45 2008/09/01 14:11:54 hawking Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.46 2008/10/26 17:11:51 hawking Exp $
27
28 # @ECLASS: python.eclass
29 # @MAINTAINER:
30 @@ -36,28 +36,6 @@
31 echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO"
32 }
33
34 -# @FUNCTION: python_disable_pyc
35 -# @DESCRIPTION:
36 -# Tells python not to automatically recompile modules to .pyc/.pyo
37 -# even if the timestamps/version stamps don't match. This is done
38 -# to protect sandbox.
39 -#
40 -# note: supported by >=dev-lang/python-2.2.3-r3 only.
41 -#
42 -python_disable_pyc() {
43 - export PYTHON_DONTCOMPILE=1
44 -}
45 -
46 -# @FUNCTION: python_enable_pyc
47 -# @DESCRIPTION:
48 -# Tells python to automatically recompile modules to .pyc/.pyo if the
49 -# timestamps/version stamps change
50 -python_enable_pyc() {
51 - unset PYTHON_DONTCOMPILE
52 -}
53 -
54 -python_disable_pyc
55 -
56 # @FUNCTION: python_version
57 # @DESCRIPTION:
58 # Run without arguments and it will export the version of python
59 @@ -81,6 +59,38 @@
60 __python_version_extract $PYVER_ALL
61 }
62
63 +# @FUNCTION: python_disable_pyc
64 +# @DESCRIPTION:
65 +# Tells python not to automatically recompile modules to .pyc/.pyo
66 +# even if the timestamps/version stamps don't match. This is done
67 +# to protect sandbox.
68 +#
69 +# note: supported by >=dev-lang/python-2.2.3-r3 only.
70 +#
71 +python_disable_pyc() {
72 + python_version
73 + if [[ ${PYVER/./,} -ge 2,6 ]]; then
74 + export PYTHONDONTWRITEBYTECODE=1
75 + else
76 + export PYTHON_DONTCOMPILE=1
77 + fi
78 +}
79 +
80 +# @FUNCTION: python_enable_pyc
81 +# @DESCRIPTION:
82 +# Tells python to automatically recompile modules to .pyc/.pyo if the
83 +# timestamps/version stamps change
84 +python_enable_pyc() {
85 + python_version
86 + if [[ ${PYVER/./,} -ge 2,6 ]]; then
87 + unset PYTHONDONTWRITEBYTECODE
88 + else
89 + unset PYTHON_DONTCOMPILE
90 + fi
91 +}
92 +
93 +python_disable_pyc
94 +
95 # @FUNCTION: python_get_libdir
96 # @DESCRIPTION:
97 # Run without arguments, returns the python library dir