change set expression syntax: operators now have a @ suffix (IOW: all operands must...
authorMarius Mauch <genone@gentoo.org>
Thu, 25 Sep 2008 17:03:18 +0000 (17:03 -0000)
committerMarius Mauch <genone@gentoo.org>
Thu, 25 Sep 2008 17:03:18 +0000 (17:03 -0000)
svn path=/main/trunk/; revision=11544

pym/_emerge/__init__.py

index afc3f58e84052bd258b63faf0f711b742a120d1a..53be7e2d5506786fee2767aaa6f9a865387012e6 100644 (file)
@@ -13391,9 +13391,11 @@ def expand_set_arguments(myfiles, myaction, root_config):
        del newargs
        newargs = []
        
-       IS_OPERATOR = "/"
-       DIFF_OPERATOR = "-"
-       UNION_OPERATOR = "+"
+       # WARNING: all operators must be of equal length
+       IS_OPERATOR = "/@"
+       DIFF_OPERATOR = "-@"
+       UNION_OPERATOR = "+@"
+       
        for a in myfiles:
                if a.startswith(SETPREFIX):
                        # support simple set operations (intersection, difference and union)
@@ -13406,9 +13408,10 @@ def expand_set_arguments(myfiles, myaction, root_config):
                                        is_pos = expression.rfind(IS_OPERATOR)
                                        diff_pos = expression.rfind(DIFF_OPERATOR)
                                        union_pos = expression.rfind(UNION_OPERATOR)
-                                       s1 = expression[:max(is_pos, diff_pos, union_pos)]
-                                       s2 = expression[max(is_pos, diff_pos, union_pos)+1:]
-                                       op = expression[max(is_pos, diff_pos, union_pos)]
+                                       op_pos = max(is_pos, diff_pos, union_pos)
+                                       s1 = expression[:op_pos]
+                                       s2 = expression[op_pos+len(IS_OPERATOR):]
+                                       op = expression[op_pos:op_pos+len(IS_OPERATOR)]
                                        if not s2 in sets:
                                                display_missing_pkg_set(root_config, s2)
                                                return (None, 1)