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 A009D13800E for ; Fri, 10 Aug 2012 15:17:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8FE41E06AF; Fri, 10 Aug 2012 15:16:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 60436E06AF for ; Fri, 10 Aug 2012 15:16:16 +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 B9A0C1B40BD for ; Fri, 10 Aug 2012 15:16:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id A0BE8E544C for ; Fri, 10 Aug 2012 15:16:12 +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: <1344611652.13ff3702fb23b3339a99ac4bea1a274f5c9fdb64.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: / X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay.py X-VCS-Directories: / X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 13ff3702fb23b3339a99ac4bea1a274f5c9fdb64 X-VCS-Branch: master Date: Fri, 10 Aug 2012 15:16:12 +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: 0e02b78f-dc27-4582-8f2c-73b51b4043a4 X-Archives-Hash: 3a92c39ee8bc0bf0274f5035e0c6ee93 commit: 13ff3702fb23b3339a99ac4bea1a274f5c9fdb64 Author: André Erdmann mailerd de> AuthorDate: Fri Aug 10 15:14:12 2012 +0000 Commit: André Erdmann mailerd de> CommitDate: Fri Aug 10 15:14:12 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=13ff3702 main script: search for config file if ROVERLAY_INSTALLED --- roverlay.py | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/roverlay.py b/roverlay.py index 7b83230..3a0232a 100755 --- a/roverlay.py +++ b/roverlay.py @@ -14,7 +14,9 @@ import sys # roverlay modules will be imported later -HIDE_EXCEPTIONS = False +ROVERLAY_INSTALLED = False +HIDE_EXCEPTIONS = False +CONFIG_FILE_NAME = "R-overlay.conf" class DIE ( object ): """Container class for various system exit 'events'.""" @@ -148,10 +150,21 @@ def roverlay_main(): 'nop' : 'does nothing', } + DEFAULT_CONFIG_FILE = CONFIG_FILE_NAME + + # search for the config file if roverlay has been installed + if ROVERLAY_INSTALLED and not os.path.exists ( DEFAULT_CONFIG_FILE ): + c = os.path.expanduser ( '~' ) + os.sep + '.' + CONFIG_FILE_NAME + if os.path.isfile ( c ): + DEFAULT_CONFIG_FILE = c + elif os.path.isfile ( '/etc/roverlay' + CONFIG_FILE_NAME ): + # os.sep is '/' if /etc exists, so don't care about that + DEFAULT_CONFIG_FILE = '/etc/roverlay' + CONFIG_FILE_NAME + commands, config_file, additional_config, extra_opts = \ roverlay.argutil.parse_argv ( command_map=COMMAND_DESCRIPTION, - default_config_file="R-overlay.conf" + default_config_file=DEFAULT_CONFIG_FILE, ) OPTION = extra_opts.get