diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-03-15 23:10:58 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-03-15 23:10:58 +0000 |
commit | bbe293629582fd6704e70c62850a8c279b95ff49 (patch) | |
tree | 3195fb35aa1f0e936e6f9b55c9dd6317498c67ab | |
parent | 1d0652095f74e33078fa49d70ce1e24bfb3280ea (diff) | |
download | portage-bbe293629582fd6704e70c62850a8c279b95ff49.tar.gz portage-bbe293629582fd6704e70c62850a8c279b95ff49.tar.bz2 portage-bbe293629582fd6704e70c62850a8c279b95ff49.zip |
When in strict mode, make paren_reduce() detect missing whitespace around
parenthesis tokens and raise an InvalidDependString exception. Strict mode
is not enabled when handling installed packages, so this will only affect
repoman and packages that haven't been installed yet. Thanks to zlin for
reporting.
svn path=/main/trunk/; revision=9471
-rw-r--r-- | pym/portage/dep.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 2a1a3cfa5..1a09d7184 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -65,6 +65,8 @@ def strip_empty(myarr): """ return [x for x in myarr if x] +_paren_whitespace_re = re.compile(r'\S(\(|\))|(\(|\))\S') + def paren_reduce(mystr,tokenize=1): """ Take a string and convert all paren enclosed entities into sublists, optionally @@ -83,6 +85,12 @@ def paren_reduce(mystr,tokenize=1): @rtype: Array @return: The reduced string in an array """ + global _dep_check_strict, _paren_whitespace_re + if _dep_check_strict: + m = _paren_whitespace_re.search(mystr) + if m is not None: + raise portage.exception.InvalidDependString( + "missing space by parenthesis: '%s'" % m.group(0)) mylist = [] while mystr: left_paren = mystr.find("(") |