1 |
Author: zmedico |
2 |
Date: 2008-03-28 12:08:27 +0000 (Fri, 28 Mar 2008) |
3 |
New Revision: 9556 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/pym/portage_dep.py |
7 |
Log: |
8 |
When in strict mode, make paren_reduce() detect missing whitespace around |
9 |
parenthesis tokens and raise an InvalidDependString exception. Strict mode |
10 |
is not enabled when handling installed packages, so this will only affect |
11 |
repoman and packages that haven't been installed yet. Thanks to zlin for |
12 |
reporting. (trunk r9471) |
13 |
|
14 |
|
15 |
Modified: main/branches/2.1.2/pym/portage_dep.py |
16 |
=================================================================== |
17 |
--- main/branches/2.1.2/pym/portage_dep.py 2008-03-28 12:05:56 UTC (rev 9555) |
18 |
+++ main/branches/2.1.2/pym/portage_dep.py 2008-03-28 12:08:27 UTC (rev 9556) |
19 |
@@ -46,6 +46,8 @@ |
20 |
""" |
21 |
return [x for x in myarr if x] |
22 |
|
23 |
+_paren_whitespace_re = re.compile(r'\S(\(|\))|(\(|\))\S') |
24 |
+ |
25 |
def paren_reduce(mystr,tokenize=1): |
26 |
""" |
27 |
Take a string and convert all paren enclosed entities into sublists, optionally |
28 |
@@ -64,6 +66,12 @@ |
29 |
@rtype: Array |
30 |
@return: The reduced string in an array |
31 |
""" |
32 |
+ global _dep_check_strict, _paren_whitespace_re |
33 |
+ if _dep_check_strict: |
34 |
+ m = _paren_whitespace_re.search(mystr) |
35 |
+ if m is not None: |
36 |
+ raise portage_exception.InvalidDependString( |
37 |
+ "missing space by parenthesis: '%s'" % m.group(0)) |
38 |
mylist = [] |
39 |
while mystr: |
40 |
left_paren = mystr.find("(") |
41 |
|
42 |
-- |
43 |
gentoo-commits@l.g.o mailing list |