From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 53DEE1381F3 for ; Fri, 2 Aug 2013 14:41:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5EEDEE0AD8; Fri, 2 Aug 2013 14:30:38 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 04FDFE0AD8 for ; Fri, 2 Aug 2013 14:30:32 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 08BC933EC25 for ; Fri, 2 Aug 2013 14:30:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id E891AE468F for ; Fri, 2 Aug 2013 14:30:29 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1375453630.fa34e37bc4e28f54e4a952331063e9b02b8f5fcc.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/hook.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: fa34e37bc4e28f54e4a952331063e9b02b8f5fcc X-VCS-Branch: master Date: Fri, 2 Aug 2013 14:30:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 18ae11b3-b3c5-45ca-be20-0bda1cdb559d X-Archives-Hash: 0017b2c829f9042a78c67937032e300b commit: fa34e37bc4e28f54e4a952331063e9b02b8f5fcc Author: André Erdmann mailerd de> AuthorDate: Fri Aug 2 14:27:10 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Fri Aug 2 14:27:10 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fa34e37b roverlay/hook: set initial directory run(): set initial working directory depending on phase --- roverlay/hook.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/roverlay/hook.py b/roverlay/hook.py index 262d3c2..d89eca0 100644 --- a/roverlay/hook.py +++ b/roverlay/hook.py @@ -4,7 +4,7 @@ # Distributed under the terms of the GNU General Public License; # either version 2 of the License, or (at your option) any later version. -import os.path +import os import logging import roverlay.config @@ -29,6 +29,10 @@ _EVENT_RESTRICT = None _EVENT_POLICY = 0 +PHASE_INITIAL_DIRS = { + 'user': True, +} + class HookException ( Exception ): pass @@ -184,9 +188,13 @@ def run ( phase, catch_failure=True ): # -- end if - if _EVENT_SCRIPT and phase_allowed ( phase ): + if _EVENT_SCRIPT and phase_allowed ( phase.lower() ): + initial_dir = PHASE_INITIAL_DIRS.get ( phase.lower() ) + if initial_dir is True: + initial_dir = os.getcwd() + if roverlay.tools.shenv.run_script ( - _EVENT_SCRIPT, phase, return_success=True + _EVENT_SCRIPT, phase, return_success=True, initial_dir=initial_dir, ): return True elif catch_failure: