diff options
| author | holger krekel <holger@merlinux.eu> | 2013-01-25 13:03:36 +0100 |
|---|---|---|
| committer | holger krekel <holger@merlinux.eu> | 2013-01-25 13:03:36 +0100 |
| commit | e55525931d0bd4d590c26bfa1b64288627b5c213 (patch) | |
| tree | 8d66e5fdab16ce5c8bef4cb6ddd4251565b4b8ce | |
| parent | 9817586672636f5dd1f025d5b01297b8aa851978 (diff) | |
| download | tox-e55525931d0bd4d590c26bfa1b64288627b5c213.tar.gz | |
make envsitespackagesdir load lazily to prevent early unsupported interpreter error
if a basepython is not installed
| -rw-r--r-- | tox/_config.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tox/_config.py b/tox/_config.py index 7a9a090..93d0123 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -122,7 +122,6 @@ class VenvConfig: name = "python" return self.envbindir.join(name) - @property def envsitepackagesdir(self): print_envsitepackagesdir = textwrap.dedent(""" import sys @@ -459,7 +458,8 @@ class IniReader: "substitution %r: %r not found in environment" % (key, envkey)) return os.environ[envkey] - if key not in self._subs: + val = self._subs.get(key, None) + if val is None: if key.startswith("[") and "]" in key: i = key.find("]") section, item = key[1:i], key[i+1:] @@ -476,7 +476,9 @@ class IniReader: raise tox.exception.ConfigError( "substitution key %r not found" % key) - return str(self._subs[key]) + if callable(val): + val = val() + return str(val) def _replace_posargs(self, match): return self._do_replace_posargs(lambda: match.group('substitution_value')) |
