1 |
hawking 08/05/29 18:36:20 |
2 |
|
3 |
Modified: python.eclass |
4 |
Log: |
5 |
Make sure python_mod* functions are run in required phases, die otherwise. |
6 |
|
7 |
Revision Changes Path |
8 |
1.37 eclass/python.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.37&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.37&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.36&r2=1.37 |
13 |
|
14 |
Index: python.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v |
17 |
retrieving revision 1.36 |
18 |
retrieving revision 1.37 |
19 |
diff -u -r1.36 -r1.37 |
20 |
--- python.eclass 29 May 2008 15:24:35 -0000 1.36 |
21 |
+++ python.eclass 29 May 2008 18:36:20 -0000 1.37 |
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.36 2008/05/29 15:24:35 hawking Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.37 2008/05/29 18:36:20 hawking Exp $ |
27 |
|
28 |
# @ECLASS: python.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -127,13 +127,18 @@ |
31 |
# @USAGE: < file > [more files ...] |
32 |
# @DESCRIPTION: |
33 |
# Given filenames, it will pre-compile the module's .pyc and .pyo. |
34 |
-# should only be run in pkg_postinst() |
35 |
+# This function should only be run in pkg_postinst() |
36 |
# |
37 |
# Example: |
38 |
# python_mod_compile /usr/lib/python2.3/site-packages/pygoogle.py |
39 |
# |
40 |
python_mod_compile() { |
41 |
local f myroot |
42 |
+ |
43 |
+ # Check if phase is pkg_postinst() |
44 |
+ [[ ${EBUILD_PHASE} != postinst ]] &&\ |
45 |
+ die "${FUNCNAME} should only be run in pkg_postinst()" |
46 |
+ |
47 |
# allow compiling for older python versions |
48 |
if [ -n "${PYTHON_OVERRIDE_PYVER}" ]; then |
49 |
PYVER=${PYTHON_OVERRIDE_PYVER} |
50 |
@@ -166,11 +171,17 @@ |
51 |
# |
52 |
# If supplied with arguments, it will recompile all modules recursively |
53 |
# in the supplied directory |
54 |
+# This function should only be run in pkg_postinst() |
55 |
# |
56 |
# Example: |
57 |
# python_mod_optimize /usr/share/codegen |
58 |
python_mod_optimize() { |
59 |
local mydirs myfiles myroot path |
60 |
+ |
61 |
+ # Check if phase is pkg_postinst() |
62 |
+ [[ ${EBUILD_PHASE} != postinst ]] &&\ |
63 |
+ die "${FUNCNAME} should only be run in pkg_postinst()" |
64 |
+ |
65 |
# strip trailing slash |
66 |
myroot="${ROOT%/}" |
67 |
|
68 |
@@ -222,9 +233,15 @@ |
69 |
# It will recursively scan all compiled python modules in the directories |
70 |
# and determine if they are orphaned (eg. their corresponding .py is missing.) |
71 |
# if they are, then it will remove their corresponding .pyc and .pyo |
72 |
+# |
73 |
+# This function should only be run in pkg_postrm() |
74 |
python_mod_cleanup() { |
75 |
local SEARCH_PATH myroot |
76 |
|
77 |
+ # Check if phase is pkg_postinst() |
78 |
+ [[ ${EBUILD_PHASE} != postrm ]] &&\ |
79 |
+ die "${FUNCNAME} should only be run in pkg_postrm()" |
80 |
+ |
81 |
# strip trailing slash |
82 |
myroot="${ROOT%/}" |
83 |
|
84 |
|
85 |
|
86 |
|
87 |
-- |
88 |
gentoo-commits@l.g.o mailing list |