From 20324ca59e2fb1d2d0b5b8396eb9532a9602446e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 28 Mar 2008 12:08:27 +0000 Subject: [PATCH] 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. (trunk r9471) svn path=/main/branches/2.1.2/; revision=9556 --- pym/portage_dep.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pym/portage_dep.py b/pym/portage_dep.py index 5bb9c0562..afcbfe6fa 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -46,6 +46,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 @@ -64,6 +66,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("(") -- 2.26.2