diff options
| -rw-r--r-- | src/distutils2/_backport/sysconfig.py | 2 | ||||
| -rw-r--r-- | src/distutils2/_backport/tests/test_sysconfig.py | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/distutils2/_backport/sysconfig.py b/src/distutils2/_backport/sysconfig.py index 62ff8ca..16a0fac 100644 --- a/src/distutils2/_backport/sysconfig.py +++ b/src/distutils2/_backport/sysconfig.py @@ -16,7 +16,7 @@ _CONFIG_DIR = os.path.normpath(os.path.dirname(__file__)) _CONFIG_FILE = os.path.join(_CONFIG_DIR, 'sysconfig.cfg') _SCHEMES = ConfigParser() _SCHEMES.read(_CONFIG_FILE) -_VAR_REPL = re.compile(r'\{(.*?)\}') +_VAR_REPL = re.compile(r'\{([^{]*?)\}') def _expand_globals(config): globals = config.items('globals') diff --git a/src/distutils2/_backport/tests/test_sysconfig.py b/src/distutils2/_backport/tests/test_sysconfig.py index 294ed5c..b51bb10 100644 --- a/src/distutils2/_backport/tests/test_sysconfig.py +++ b/src/distutils2/_backport/tests/test_sysconfig.py @@ -87,9 +87,17 @@ class TestSysConfig(unittest2.TestCase): elif os.path.isdir(path): shutil.rmtree(path) - def test_var_expansion_pattern(self): - """Assert that the {curly brace token} expansion pattern counts the second { as part of the substitution key in expressions like {{something}.""" - self.failUnlessEqual(_subst_vars('thing{{stuffvar}', {'{stuffvar': 'stuff'}), 'thingstuff') + 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.failUnlessEqual(_subst_vars('{py{version}}', {'version': '31'}), '{py31}') def test_get_paths(self): scheme = get_paths() |
