Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/
Date: Fri, 02 Aug 2013 14:41:40
Message-Id: 1375453630.fa34e37bc4e28f54e4a952331063e9b02b8f5fcc.dywi@gentoo
1 commit: fa34e37bc4e28f54e4a952331063e9b02b8f5fcc
2 Author: André Erdmann <dywi <AT> mailerd <DOT> de>
3 AuthorDate: Fri Aug 2 14:27:10 2013 +0000
4 Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
5 CommitDate: Fri Aug 2 14:27:10 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fa34e37b
7
8 roverlay/hook: set initial directory
9
10 run(): set initial working directory depending on phase
11
12 ---
13 roverlay/hook.py | 14 +++++++++++---
14 1 file changed, 11 insertions(+), 3 deletions(-)
15
16 diff --git a/roverlay/hook.py b/roverlay/hook.py
17 index 262d3c2..d89eca0 100644
18 --- a/roverlay/hook.py
19 +++ b/roverlay/hook.py
20 @@ -4,7 +4,7 @@
21 # Distributed under the terms of the GNU General Public License;
22 # either version 2 of the License, or (at your option) any later version.
23
24 -import os.path
25 +import os
26 import logging
27
28 import roverlay.config
29 @@ -29,6 +29,10 @@ _EVENT_RESTRICT = None
30 _EVENT_POLICY = 0
31
32
33 +PHASE_INITIAL_DIRS = {
34 + 'user': True,
35 +}
36 +
37 class HookException ( Exception ):
38 pass
39
40 @@ -184,9 +188,13 @@ def run ( phase, catch_failure=True ):
41 # -- end if
42
43
44 - if _EVENT_SCRIPT and phase_allowed ( phase ):
45 + if _EVENT_SCRIPT and phase_allowed ( phase.lower() ):
46 + initial_dir = PHASE_INITIAL_DIRS.get ( phase.lower() )
47 + if initial_dir is True:
48 + initial_dir = os.getcwd()
49 +
50 if roverlay.tools.shenv.run_script (
51 - _EVENT_SCRIPT, phase, return_success=True
52 + _EVENT_SCRIPT, phase, return_success=True, initial_dir=initial_dir,
53 ):
54 return True
55 elif catch_failure: