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 C6CFF138779 for ; Sat, 14 Jun 2014 05:58:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 64284E09BF; Sat, 14 Jun 2014 05:58:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A5354E09BE for ; Sat, 14 Jun 2014 05:58:15 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A0CE633FF46 for ; Sat, 14 Jun 2014 05:58:14 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id F0DE71836F for ; Sat, 14 Jun 2014 05:58:11 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1402724772.0349b7547b55e6d3810a18691fb38675374ffd7e.dol-sen@gentoo> Subject: [gentoo-commits] proj/catalyst:pending commit in: catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/config.py catalyst/main.py X-VCS-Directories: catalyst/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 0349b7547b55e6d3810a18691fb38675374ffd7e X-VCS-Branch: pending Date: Sat, 14 Jun 2014 05:58:11 +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: 954c7bfc-df5d-48b8-8c9c-abf225f38fc3 X-Archives-Hash: 8d435cc7b36684a880296cbab5f261f7 commit: 0349b7547b55e6d3810a18691fb38675374ffd7e Author: Brian Dolbec gentoo org> AuthorDate: Fri Jan 25 04:00:24 2013 +0000 Commit: Brian Dolbec gmail com> CommitDate: Sat Jun 14 05:46:12 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=0349b754 Extend ParserBase to do variable substitution. Also add embedded variable substitiution to default settings. Why are we not using python's built-in ConfigParser? We'll migrate it later. --- catalyst/config.py | 3 +++ catalyst/main.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/catalyst/config.py b/catalyst/config.py index 8b23342..bf3c7c6 100644 --- a/catalyst/config.py +++ b/catalyst/config.py @@ -66,6 +66,9 @@ class ParserBase: # Start a new array using the first element of mobjs cur_array = [mobjs[0]] if mobjs[1]: + # do any variable substitiution embeded in it with + # the values already obtained + mobjs[1] = mobjs[1] % values if self.multiple_values: # split on white space creating additional array elements # subarray = white_space.split(mobjs[1]) diff --git a/catalyst/main.py b/catalyst/main.py index 1446cf9..5fa3f1b 100644 --- a/catalyst/main.py +++ b/catalyst/main.py @@ -116,7 +116,6 @@ def parse_config(myconfig): # add our python base directory to use for loading target arch's conf_values["PythonDir"] = __selfpath__ - # print out any options messages for opt in conf_values['options']: if opt in option_messages: @@ -133,6 +132,11 @@ def parse_config(myconfig): if "envscript" in myconf: print "Envscript support enabled." + # take care of any variable substitutions that may be left + for x in list(conf_values): + if isinstance(conf_values[x], str): + conf_values[x] = conf_values[x] % conf_values + def import_module(target): """