public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/
@ 2014-09-02  2:43 99% Brian Dolbec
  0 siblings, 0 replies; 1+ results
From: Brian Dolbec @ 2014-09-02  2:43 UTC (permalink / raw
  To: gentoo-commits

commit:     99e1ff21cc544222c69eede96b30e627bec9d958
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 25 04:00:24 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep  2 02:13:44 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=99e1ff21

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):
 	"""


^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-09-02  2:43 99% [gentoo-commits] proj/catalyst:pending commit in: catalyst/ Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox