Mercurial > hg > graal-compiler
changeset 17169:a8c0553cb2e4
restore support for expanding environment variables in suite declarations
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 19 Sep 2014 22:52:25 +0200 |
parents | 65c75f0bfc7b |
children | fe5d4383b505 a5535a5e9197 |
files | mxtool/mx.py |
diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mxtool/mx.py Fri Sep 19 09:53:13 2014 -0700 +++ b/mxtool/mx.py Fri Sep 19 22:52:25 2014 +0200 @@ -847,7 +847,6 @@ if attrs is None: attrs = OrderedDict() m[name] = attrs - value = expandvars_in_property(value) attrs[attr] = value return suite @@ -965,6 +964,22 @@ suite = None dictName = 'suite' + def expand(value, context): + if isinstance(value, types.DictionaryType): + for n, v in value.iteritems(): + value[n] = expand(v, context + [n]) + elif isinstance(value, types.ListType): + for i in range(len(value)): + value[i] = expand(value[i], context + [str(i)]) + else: + if not isinstance(value, types.StringTypes): + abort('value of ' + '.'.join(context) + ' is of unexpected type ' + str(type(value))) + value = expandvars(value) + if '$' in value or '%' in value: + abort('value of ' + '.'.join(context) + ' contains an undefined environment variable: ' + value) + + return value + moduleName = 'projects' modulePath = join(mxDir, moduleName + '.py') while exists(modulePath): @@ -996,7 +1011,7 @@ if not hasattr(module, dictName): abort(modulePath + ' must define a variable named "' + dictName + '"') - d = getattr(module, dictName) + d = expand(getattr(module, dictName), [dictName]) sections = ['projects', 'libraries', 'jrelibraries', 'distributions'] + (['distribution_extensions'] if suite else ['name', 'mxversion']) unknown = d.viewkeys() - sections if unknown: