default is now stable stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 16 Feb 2010 15:35:06 +0100
branchstable
changeset 493 60caf3e67384
parent 482 f4c0c6f9b202 (current diff)
parent 492 63430a82aaf8 (diff)
child 496 3d89e70448af
default is now stable
--- a/.hgtags	Wed Dec 23 08:53:15 2009 +0100
+++ b/.hgtags	Tue Feb 16 15:35:06 2010 +0100
@@ -41,3 +41,5 @@
 bf6e2008180dab292fe49c70a47883852fb8d46b rql-debian-version-0.22.2-1
 42004883d4cd6b42f7898a93df8537d5b87a662d rql-version-0.23.0
 7dd29e42751ebebae4b50126dfb2071d9b2e8de1 rql-debian-version-0.23.0-1
+5cb31b7a463ea8fcc56da4e768648a2f818ec0ee rql-version-0.24.0
+4f8562728585d53053e914171180e623e73ac235 rql-debian-version-0.24.0-1
--- a/ChangeLog	Wed Dec 23 08:53:15 2009 +0100
+++ b/ChangeLog	Tue Feb 16 15:35:06 2010 +0100
@@ -1,6 +1,15 @@
 ChangeLog for RQL
 =================
 
+2010-02-10  --  0.24.0
+    * update to yams 0.27 api
+
+    * fully dropped mx support
+
+    * various bugs fixed
+
+
+
 2009-08-26  --  0.23.0
     * Union.locate_subquery now return a 2-uple (select subquery, column index in the subquery)
 
--- a/__init__.py	Wed Dec 23 08:53:15 2009 +0100
+++ b/__init__.py	Tue Feb 16 15:35:06 2010 +0100
@@ -1,7 +1,7 @@
 """RQL library (implementation independant).
 
 :copyright:
-  2001-2009 `LOGILAB S.A. <http://www.logilab.fr>`_ (Paris, FRANCE),
+  2001-2010 `LOGILAB S.A. <http://www.logilab.fr>`_ (Paris, FRANCE),
   all rights reserved.
 
 :contact:
--- a/__pkginfo__.py	Wed Dec 23 08:53:15 2009 +0100
+++ b/__pkginfo__.py	Tue Feb 16 15:35:06 2010 +0100
@@ -1,21 +1,19 @@
 # pylint: disable-msg=W0622
 """RQL packaging information.
 
-:copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: General Public License version 2 - http://www.gnu.org/licenses
 """
 __docformat__ = "restructuredtext en"
 
 modname = "rql"
-numversion = (0, 23, 0)
+numversion = (0, 24, 0)
 version = '.'.join(str(num) for num in numversion)
 
 license = 'LGPL'
-copyright = '''Copyright (c) 2003-2009 LOGILAB S.A. (Paris, FRANCE).
-http://www.logilab.fr/ -- mailto:contact@logilab.fr'''
 
-author = "Sylvain Thenault"
+author = "Logilab"
 author_email = "contact@logilab.fr"
 
 short_desc = "relationship query language (RQL) utilities"
@@ -25,10 +23,6 @@
 web = "http://www.logilab.org/project/rql"
 ftp = "ftp://ftp.logilab.org/pub/rql"
 
-
-# debianize info
-debian_maintainer = 'Sylvain Thenault'
-debian_maintainer_email = 'sylvain.thenault@logilab.fr'
 pyversions = ['2.4']
 
 
@@ -58,16 +52,14 @@
 if sys.platform != 'win32':
     ext_modules = [Extension('rql_solve',
                              ['gecode_solver.cpp'],
-                              libraries=['gecodeint', 'gecodekernel', 
-                                         'gecodesearch','gecodesupport'],
+                              libraries=['gecodeint', 'gecodekernel', 'gecodesearch',],
                              extra_compile_args=['-DGE_VERSION=%s' % GECODE_VERSION],
                          )
                    ]
 else:
     ext_modules = [ Extension('rql_solve',
                               ['gecode_solver.cpp'],
-                              libraries=['gecodeint', 'gecodekernel', 
-                                         'gecodesearch','gecodesupport'],
+                              libraries=['gecodeint', 'gecodekernel', 'gecodesearch',],
                               extra_compile_args=['-DGE_VERSION=%s' % GECODE_VERSION],
                               extra_link_args=['-static-libgcc'],
                               )
--- a/debian/changelog	Wed Dec 23 08:53:15 2009 +0100
+++ b/debian/changelog	Tue Feb 16 15:35:06 2010 +0100
@@ -1,3 +1,9 @@
+rql (0.24.0-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Sylvain Thénault <sylvain.thenault@logilab.fr>  Wed, 10 Feb 2010 08:34:01 +0100
+
 rql (0.23.0-1) unstable; urgency=low
 
   * new upstream release
--- a/gecode_solver.cpp	Wed Dec 23 08:53:15 2009 +0100
+++ b/gecode_solver.cpp	Tue Feb 16 15:35:06 2010 +0100
@@ -365,7 +365,11 @@
 	unsigned int n_b = 0;
 	if (s->status() != SS_FAILED) {
 	    n_p = s->propagators();
+#if GE_VERSION<PM_VERSION(3,2,0)
 	    n_b = s->branchings();
+#else
+	    n_b = s->branchers();
+#endif
 	}
 #if GE_VERSION<PM_VERSION(2,0,0)
     Engine<RqlSolver> e(s);
--- a/nodes.py	Wed Dec 23 08:53:15 2009 +0100
+++ b/nodes.py	Tue Feb 16 15:35:06 2010 +0100
@@ -3,7 +3,7 @@
 This module defines all the nodes we can find in a RQL Syntax tree, except
 root nodes, defined in the `stmts` module.
 
-:copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: General Public License version 2 - http://www.gnu.org/licenses
 """
@@ -23,12 +23,6 @@
                             'String', 'Substitute', 'etype'))
 
 
-# keep using mx DateTime by default for bw compat
-def use_py_datetime():
-    global KEYWORD_MAP
-    KEYWORD_MAP = {'NOW' : datetime.now,
-                   'TODAY': date.today}
-
 ETYPE_PYOBJ_MAP = { bool: 'Boolean',
                     int: 'Int',
                     long: 'Int',
@@ -42,21 +36,14 @@
                     timedelta: 'Interval',
                     }
 
-
-try:
-    from mx.DateTime import DateTimeType, DateTimeDeltaType, today, now
-    KEYWORD_MAP = {'NOW' : now,
-                   'TODAY': today}
-    ETYPE_PYOBJ_MAP[DateTimeType] = 'Datetime'
-    ETYPE_PYOBJ_MAP[DateTimeDeltaType] = 'Datetime'
-except:
-    use_py_datetime()
+KEYWORD_MAP = {'NOW' : datetime.now,
+               'TODAY': date.today}
 
 def etype_from_pyobj(value):
     """guess yams type from python value"""
     # note:
-    # * Password is not selectable so no problem)
-    # * use type(value) and not value.__class__ since mx instances have no
+    # * Password is not selectable so no problem
+    # * use type(value) and not value.__class__ since C instances may have no
     #   __class__ attribute
     return ETYPE_PYOBJ_MAP[type(value)]
 
@@ -480,7 +467,7 @@
         elif operator == '=' and isinstance(value, Constant) and \
                  value.type is None:
             operator = 'IS'
-        assert operator in ('<', '<=', '=', '>=', '>', 'ILIKE', 'LIKE', 'IS'), operator
+        assert operator in ('=', '<', '<=', '>=', '>', 'ILIKE', 'LIKE', 'IS'), operator
         self.operator = operator.encode()
         if value is not None:
             self.append(value)
@@ -919,7 +906,7 @@
                 if mainindex in lhsvar.stinfo['selected']:
                     return tr(rtype)
                 if mainindex in rhsvar.stinfo['selected']:
-                    if schema is not None and rschema.symetric:
+                    if schema is not None and rschema.symmetric:
                         return tr(rtype)
                     return tr(rtype + '_object')
             if rhsvar is self:
--- a/stcheck.py	Wed Dec 23 08:53:15 2009 +0100
+++ b/stcheck.py	Tue Feb 16 15:35:06 2010 +0100
@@ -34,7 +34,7 @@
     """Check a RQL syntax tree for errors not detected on parsing.
 
     Some simple rewriting of the tree may be done too:
-    * if a OR is used on a symetric relation
+    * if a OR is used on a symmetric relation
     * IN function with a single child
 
     use assertions for internal error but specific `BadRQLQuery` exception for
@@ -146,10 +146,10 @@
                 rtype = graph[(tovar, fromvar)]
                 cardidx = 1
             rschema = self.schema.rschema(rtype)
-            for rdef in rschema.iter_rdefs():
+            for rdef in rschema.rdefs.itervalues():
                 # XXX aggregats handling needs much probably some enhancements...
                 if not (tovar in select.aggregated
-                        or rschema.rproperty(rdef[0], rdef[1], 'cardinality')[cardidx] in '?1'):
+                        or rdef.cardinality[cardidx] in '?1'):
                     return False
             fromvar = tovar
         return True
@@ -236,14 +236,14 @@
 
     def visit_or(self, ou, errors):
         #assert len(ou.children) == 2, len(ou.children)
-        # simplify Ored expression of a symetric relation
+        # simplify Ored expression of a symmetric relation
         r1, r2 = ou.children[0], ou.children[1]
         try:
             r1type = r1.r_type
             r2type = r2.r_type
         except AttributeError:
             return # can't be
-        if r1type == r2type and self.schema.rschema(r1type).symetric:
+        if r1type == r2type and self.schema.rschema(r1type).symmetric:
             lhs1, rhs1 = r1.get_variable_parts()
             lhs2, rhs2 = r2.get_variable_parts()
             try:
--- a/test/unittest_analyze.py	Wed Dec 23 08:53:15 2009 +0100
+++ b/test/unittest_analyze.py	Tue Feb 16 15:35:06 2010 +0100
@@ -1,4 +1,4 @@
-from logilab.common.testlib import TestCase, unittest_main
+from logilab.common.testlib import TestCase, unittest_main, mock_object as mock
 
 from rql import RQLHelper, TypeResolverException
 
@@ -18,18 +18,15 @@
 
 
 class RelationSchema(ERSchema):
-    def __init__(self, assoc_types, symetric=False, card=None):
+    def __init__(self, assoc_types, symmetric=False, card=None):
         self.assoc_types = assoc_types
         self.subj_types = [e_type[0] for e_type in assoc_types]
-        self.final = False
         d = {}
         for e_type, dest_types in assoc_types:
             for e_type in dest_types:
                 d[e_type] = 1
-                if e_type in ('Int', 'Datetime', 'String'):
-                    self.final = True
         self.obj_types = d.keys()
-        self.symetric = symetric
+        self.symmetric = symmetric
         self.inlined = False
         if card is None:
             if self.final:
@@ -37,6 +34,11 @@
             else:
                 card = '**'
         self.card = card
+        self.rdefs = {}
+        for subjtype, dest_types in self.assoc_types:
+            for objtype in dest_types:
+                self.rdefs[(subjtype, objtype)] = mock(subject=subjtype, object=objtype, cardinality=self.card)
+
 
     def associations(self):
         return self.assoc_types
@@ -51,14 +53,6 @@
     def final(self):
         return self.obj_types[0] in FINAL_ETYPES
 
-    def iter_rdefs(self):
-        for subjtype, dest_types in self.assoc_types:
-            for objtype in dest_types:
-                yield subjtype, objtype
-
-    def rproperty(self, subj, obj, rprop):
-        assert rprop == 'cardinality'
-        return self.card
 
 class EntitySchema(ERSchema):
     def __init__(self, type, specialized_by=None):
@@ -124,7 +118,7 @@
                                          ('Student', ('Student',) ),
                                          ('Person', ('Student',) ),
                                          ),
-                                        symetric=True),
+                                        symmetric=True),
             'located' : RelationSchema( ( ('Person', ('Address',) ),
                                           ('Student', ('Address',) ),
                                           ('Company', ('Address',) ),
@@ -416,7 +410,7 @@
         sols = sorted(node.children[0].solutions)
         self.assertEqual(sols, [{'E1': 'Company'}])
 
-    def test_not_symetric_relation_eid(self):
+    def test_not_symmetric_relation_eid(self):
         node = self.helper.parse('Any P WHERE X eid 0, NOT X connait P')
         self.helper.compute_solutions(node, debug=DEBUG)
         sols = sorted(node.children[0].solutions)
--- a/test/unittest_nodes.py	Wed Dec 23 08:53:15 2009 +0100
+++ b/test/unittest_nodes.py	Tue Feb 16 15:35:06 2010 +0100
@@ -1,5 +1,7 @@
 # -*- coding: iso-8859-1 -*-
 
+from datetime import date, datetime
+
 from logilab.common.testlib import TestCase, unittest_main
 
 from rql import nodes, stmts, parse, BadRQLQuery, RQLHelper
@@ -28,8 +30,8 @@
         self.assertEquals(nodes.etype_from_pyobj(0.), 'Float')
 
     def test_datetime(self):
-        self.assertEquals(nodes.etype_from_pyobj(nodes.now()), 'Datetime')
-        self.assertEquals(nodes.etype_from_pyobj(nodes.today()), 'Datetime')
+        self.assertEquals(nodes.etype_from_pyobj(datetime.now()), 'Datetime')
+        self.assertEquals(nodes.etype_from_pyobj(date.today()), 'Date')
 
     def test_string(self):
         self.assertEquals(nodes.etype_from_pyobj('hop'), 'String')
--- a/test/unittest_stcheck.py	Wed Dec 23 08:53:15 2009 +0100
+++ b/test/unittest_stcheck.py	Tue Feb 16 15:35:06 2010 +0100
@@ -108,7 +108,7 @@
 # no more supported, use outerjoin explicitly
 #            ('Any X,Y WHERE X work_for Y OR NOT X work_for Y', 'Any X,Y WHERE X? work_for Y?'),
 #            ('Any X,Y WHERE NOT X work_for Y OR X work_for Y', 'Any X,Y WHERE X? work_for Y?'),
-            # test symetric OR rewrite
+            # test symmetric OR rewrite
             ("DISTINCT Any P WHERE P connait S OR S connait P, S name 'chouette'",
              "DISTINCT Any P WHERE P connait S, S name 'chouette'"),
             # queries that should not be rewritten