def _expand_attrs(self, attrs): for attr in attrs: val = getattr(self, attr) if val is not None: if os.name == 'posix' or os.name == 'nt': val = os.path.expanduser(val) # see if we want to push this work in sysconfig XXX val = sysconfig._subst_vars(val, self.config_vars) setattr(self, attr, val)
def test_nested_var_substitution(self): # Assert that the {curly brace token} expansion pattern will replace # only the inner {something} on nested expressions like {py{something}} on # the first pass. # We have no plans to make use of this, but it keeps the option open for # the future, at the cost only of disallowing { itself as a piece of a # substitution key (which would be weird). self.assertEqual(_subst_vars('{py{version}}', {'version': '31'}), '{py31}')