From 9513888e4dfdcb5cb2892f8490ec93f6e2518b65 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 11 May 2008 23:24:08 +0000 Subject: Bug #221755 - Enable variable substitution in make.defaults to work accross multiple files instead of being confined to a single file. This allows profiles to create incremental-like behavior with non-incremental variables when desired. (trunk r10293) svn path=/main/branches/2.1.2/; revision=10294 --- pym/portage.py | 9 +++++++-- pym/portage_util.py | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pym/portage.py b/pym/portage.py index 2ee750e52..a48f23e3d 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1440,8 +1440,13 @@ class config: self.make_defaults_use = [] self.mygcfg = {} if self.profiles: - mygcfg_dlists = [getconfig(os.path.join(x, "make.defaults")) \ - for x in self.profiles] + mygcfg_dlists = [] + var_map = {} + for x in self.profiles: + var_map = getconfig(os.path.join(x, "make.defaults"), + expand=var_map) + mygcfg_dlists.append(var_map) + for cfg in mygcfg_dlists: if cfg: self.make_defaults_use.append(cfg.get("USE", "")) diff --git a/pym/portage_util.py b/pym/portage_util.py index eb54076d4..e75e0cb15 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -306,7 +306,13 @@ class _tolerant_shlex(shlex.shlex): return (newfile, StringIO.StringIO()) def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True): - mykeys={} + if isinstance(expand, dict): + # Some existing variable definitions have been + # passed in, for use in substitutions. + mykeys = expand.copy() + expand = True + else: + mykeys = {} try: f=open(mycfg,'r') except IOError, e: -- cgit v1.2.3-1-g7c22