merge changes from stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Wed, 28 Aug 2013 23:30:50 +0200
changeset 719 4e574315c418
parent 708 0c6345ca92b1 (current diff)
parent 718 ff79e47ff011 (diff)
child 724 3d5a9d57cf95
merge changes from stable
--- a/.hgtags	Wed Apr 10 14:06:10 2013 +0200
+++ b/.hgtags	Wed Aug 28 23:30:50 2013 +0200
@@ -78,3 +78,6 @@
 2ce80cbd45f769b8119a2d37b4fe784e9ad9d291 rql-version-0.31.3
 f388ee9b713d90ba1d4a9fe4264562080bdfb696 rql-debian-version-0.31.3-1
 496945a4ed23f645f2e4847ebf60c84b8f27d338 rql-centos-version-0.31.3-1
+5cad47e1ffbf6c9a234d8a355c3c93655ba32737 rql-centos-version-0.31.4-1
+5cad47e1ffbf6c9a234d8a355c3c93655ba32737 rql-version-0.31.4
+5cad47e1ffbf6c9a234d8a355c3c93655ba32737 rql-debian-version-0.31.4-1
--- a/__pkginfo__.py	Wed Apr 10 14:06:10 2013 +0200
+++ b/__pkginfo__.py	Wed Aug 28 23:30:50 2013 +0200
@@ -20,7 +20,7 @@
 __docformat__ = "restructuredtext en"
 
 modname = "rql"
-numversion = (0, 31, 3)
+numversion = (0, 31, 4)
 version = '.'.join(str(num) for num in numversion)
 
 license = 'LGPL'
--- a/compare.py	Wed Apr 10 14:06:10 2013 +0200
+++ b/compare.py	Wed Aug 28 23:30:50 2013 +0200
@@ -116,7 +116,7 @@
         r_list = canon['restriction'].setdefault(r_type, [])
         done = {}
         for key in keys:
-            if done.has_key(key):
+            if key in done:
                 continue
             done[key] = None
             for expr in canon_dict[key]:
--- a/debian/changelog	Wed Apr 10 14:06:10 2013 +0200
+++ b/debian/changelog	Wed Aug 28 23:30:50 2013 +0200
@@ -1,3 +1,9 @@
+rql (0.31.4-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Julien Cristau <julien.cristau@logilab.fr>  Fri, 02 Aug 2013 16:43:35 +0200
+
 rql (0.31.3-1) unstable; urgency=low
 
   * new upstream release
--- a/debian/rules	Wed Apr 10 14:06:10 2013 +0200
+++ b/debian/rules	Wed Aug 28 23:30:50 2013 +0200
@@ -14,10 +14,11 @@
 build: build-stamp
 build-stamp:
 	dh_testdir
-	(for PYTHON in `pyversions -r`; do \
-	    NO_SETUPTOOLS=1 $${PYTHON} setup.py build ; done )
-	${MAKE} -C doc html || true
+	for PYTHON in `pyversions -r`; do \
+	    RQL_FORCE_GECODE=1 NO_SETUPTOOLS=1 $${PYTHON} setup.py build || exit; done
+	$(MAKE) -C doc html || true
 	touch build-stamp
+
 clean:
 	dh_testdir
 	dh_testroot
@@ -32,13 +33,13 @@
 	dh_testroot
 	dh_clean -k
 	dh_installdirs
-	(for PYTHON in `pyversions -r`; do \
-		NO_SETUPTOOLS=1 $${PYTHON} setup.py install --no-compile --prefix=debian/python-rql/usr/ ; \
-	done)
+	for PYTHON in `pyversions -r`; do \
+		NO_SETUPTOOLS=1 $${PYTHON} setup.py install --no-compile --prefix=debian/python-rql/usr/ || exit; \
+	done
 	# remove test directory (installed in in the doc directory)
 	rm -rf debian/python-rql/usr/lib/python*/site-packages/rql/test
 	# install tests
-	(cd test && find . -type f -not \( -name '*.pyc' \) -exec install -D --mode=644 {} ../debian/python-rql/usr/share/doc/python-rql/test/{} \;)
+	cd test && find . -type f -not \( -name '*.pyc' \) -exec install -D --mode=644 {} ../debian/python-rql/usr/share/doc/python-rql/test/{} \;
 
 # Build architecture-independent files here.
 binary-indep:
--- a/gecode_solver.cpp	Wed Apr 10 14:06:10 2013 +0200
+++ b/gecode_solver.cpp	Wed Aug 28 23:30:50 2013 +0200
@@ -40,6 +40,11 @@
 #define convexHull convex
 #endif
 
+#if GE_VERSION >= PM_VERSION(4, 0, 0)
+#define INT_VAR_NONE INT_VAR_NONE()
+#define INT_VAL_MIN INT_VAL_MIN()
+#endif
+
 using namespace std;
 using namespace Gecode;
 
@@ -410,9 +415,12 @@
 		 << "\tdepth:        " << stat.depth << endl
 		 << "\tnode:       " << stat.node << endl
 #endif
+#if GE_VERSION < PM_VERSION(4,2,0)
 		 << "\tpeak memory:   "
 		 << static_cast<int>((stat.memory+1023) / 1024) << " KB"
-		 << endl;
+		 << endl
+#endif
+		    ;
 	}
     }
 
--- a/nodes.py	Wed Apr 10 14:06:10 2013 +0200
+++ b/nodes.py	Wed Aug 28 23:30:50 2013 +0200
@@ -229,7 +229,8 @@
                 if etype not in etypes:
                     raise RQLException('%r not in %r' % (etype, etypes))
                 if len(etypes) > 1:
-                    for child in istarget.children:
+                    # iterate a copy of children because it's modified inplace
+                    for child in istarget.children[:]:
                         if child.value != etype:
                             istarget.remove(child)
             else:
--- a/python-rql.spec	Wed Apr 10 14:06:10 2013 +0200
+++ b/python-rql.spec	Wed Aug 28 23:30:50 2013 +0200
@@ -8,7 +8,7 @@
 %endif
 
 Name:           %{python}-rql
-Version:        0.31.3
+Version:        0.31.4
 Release:        logilab.1%{?dist}
 Summary:        relationship query language (RQL) utilities
 
--- a/setup.py	Wed Apr 10 14:06:10 2013 +0200
+++ b/setup.py	Wed Aug 28 23:30:50 2013 +0200
@@ -161,26 +161,27 @@
                 dest = join(self.install_dir, base, directory)
                 export(directory, dest, verbose=False)
 
-class MyBuildExt(build_ext.build_ext):
-    """Extend build_ext command to pass through compilation error.
-    In fact, if gecode extension fail, rql will use logilab.constraint
-    """
-    def run(self):
-        from distutils.errors import CompileError
-        try:
-            build_ext.build_ext.run(self)
-        except CompileError:
-            import traceback
-            traceback.print_exc()
-            sys.stderr.write('================================\n'
-                             'The compilation of the gecode C extension failed. '
-                             'rql will use logilab.constraint which is a pure '
-                             'python implementation. '
-                             'Please note that the C extension run faster. '
-                             'So, install a compiler then install rql again with'
-                             ' the "force" option for better performance.\n'
-                             '================================\n')
-            pass
+if os.environ.get('RQL_FORCE_GECODE'):
+    MyBuildExt = build_ext.build_ext
+else:
+    class MyBuildExt(build_ext.build_ext):
+        """Extend build_ext command to pass through compilation error.
+        In fact, if gecode extension fail, rql will use logilab.constraint
+        """
+        def run(self):
+            try:
+                build_ext.build_ext.run(self)
+            except Exception:
+                import traceback
+                traceback.print_exc()
+                sys.stderr.write('================================\n'
+                                 'The compilation of the gecode C extension failed. '
+                                 'rql will use logilab.constraint which is a pure '
+                                 'python implementation. '
+                                 'Please note that the C extension run faster. '
+                                 'So, install a compiler then install rql again with'
+                                 ' the "force" option for better performance.\n'
+                                 '================================\n')
 
 def install(**kwargs):
     """setup entry point"""
--- a/stmts.py	Wed Apr 10 14:06:10 2013 +0200
+++ b/stmts.py	Wed Aug 28 23:30:50 2013 +0200
@@ -44,7 +44,7 @@
                 raise AssertionError('vref %r is not in the tree' % vref)
             refs[id(vref)] = 1
     for vref in varrefs:
-        if not refs.has_key(id(vref)):
+        if id(vref) not in refs:
             raise AssertionError('vref %r is not referenced (%r)' % (vref, vref.stmt))
     return True
 
@@ -998,7 +998,7 @@
         """add a relation to the list of inserted relations"""
         var = relation.children[0].variable
         rhs = relation.children[1]
-        if not self.inserted_variables.has_key(var):
+        if var not in self.inserted_variables:
             if isinstance(rhs, nodes.Constant):
                 msg = 'Using variable %s in declaration but %s is not an \
 insertion variable'
--- a/test/unittest_analyze.py	Wed Apr 10 14:06:10 2013 +0200
+++ b/test/unittest_analyze.py	Wed Aug 28 23:30:50 2013 +0200
@@ -170,10 +170,10 @@
         return self._relations.keys()
 
     def has_entity(self, e_type):
-        return self._types.has_key(e_type)
+        return e_type in self._types
 
     def has_relation(self, r_type):
-        return self._relations.has_key(r_type)
+        return r_type in self._relations
 
     def __contains__(self, ertype):
         return self.has_entity(ertype) or self.has_relation(ertype)
--- a/test/unittest_nodes.py	Wed Apr 10 14:06:10 2013 +0200
+++ b/test/unittest_nodes.py	Wed Aug 28 23:30:50 2013 +0200
@@ -70,12 +70,12 @@
         self.assertEqual(tree.as_string(), 'Any X WHERE X is Person')
 
     def test_add_new_is_type_restriction_in(self):
-        tree = self.parse('Any X WHERE X is IN(Person, Company)')
+        tree = self.parse('Any X WHERE X is IN(Person, Company, Student)')
         select = tree.children[0]
         x = select.get_selected_variables().next()
-        select.add_type_restriction(x.variable, 'Company')
+        select.add_type_restriction(x.variable, 'Person')
         # implementation is KISS (the IN remains)
-        self.assertEqual(tree.as_string(), 'Any X WHERE X is IN(Company)')
+        self.assertEqual(tree.as_string(), 'Any X WHERE X is IN(Person)')
 
     def test_add_is_in_type_restriction(self):
         tree = self.parse('Any X WHERE X is IN(Person, Company)')
--- a/utils.py	Wed Apr 10 14:06:10 2013 +0200
+++ b/utils.py	Wed Aug 28 23:30:50 2013 +0200
@@ -61,7 +61,7 @@
 KEYWORDS = set(('INSERT', 'SET', 'DELETE',
                 'UNION', 'WITH', 'BEING',
                 'WHERE', 'AND', 'OR', 'NOT'
-                'IN', 'LIKE',
+                'IN', 'LIKE', 'ILIKE', 'EXISTS', 'DISTINCT',
                 'TRUE', 'FALSE', 'NULL', 'TODAY',
                 'GROUPBY', 'HAVING', 'ORDERBY', 'ASC', 'DESC',
                 'LIMIT', 'OFFSET'))