summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Abramowitz <marc@marc-abramowitz.com>2014-04-03 15:45:55 -0700
committerMarc Abramowitz <marc@marc-abramowitz.com>2014-04-03 15:45:55 -0700
commita3c4eb4a7c0f5128948e7346e900a5d79d85ecb0 (patch)
treef1f8688de1c43ad8aa4015a53431ac169c94b0e4
parentcb12ef1863bfeaab64857117ea7c993898482a39 (diff)
downloadtox-a3c4eb4a7c0f5128948e7346e900a5d79d85ecb0.tar.gz
Allow backslashing curly braces to prevent expansion
e.g.: commands=echo \{posargs\} = {posargs}
-rw-r--r--tox/_config.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tox/_config.py b/tox/_config.py
index 6006fa9..4d54924 100644
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -451,8 +451,8 @@ class IndexServerConfig:
self.url = url
RE_ITEM_REF = re.compile(
- '''
- [{]
+ r'''
+ (?<!\\)[{]
(?:(?P<sub_type>[^[:{}]+):)? # optional sub_type for special rules
(?P<substitution_value>[^{}]*) # substitution key
[}]
@@ -686,7 +686,7 @@ class CommandParser(object):
def word_has_ended():
return ((cur_char in string.whitespace and ps.word and
ps.word[-1] not in string.whitespace) or
- (cur_char == '{' and ps.depth == 0) or
+ (cur_char == '{' and ps.depth == 0 and not ps.word.endswith('\\')) or
(ps.depth == 0 and ps.word and ps.word[-1] == '}') or
(cur_char not in string.whitespace and ps.word and
ps.word.strip() == ''))