summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephanie Marcu <stephanie.marcu@logilab.fr>2008-10-06 08:41:18 +0200
committerStephanie Marcu <stephanie.marcu@logilab.fr>2008-10-06 08:41:18 +0200
commit02315464a5a6d91aa1981d9e6c99f37fab4d03b9 (patch)
tree9a775f9ce580d7676fc1027b70642dc85cb3ec55
parentf5c1e0bdec77eb6580276d1465372b239d65611a (diff)
parent4978625fe47703ef78a8022ffc37f4c154754bba (diff)
downloadlogilab-common-02315464a5a6d91aa1981d9e6c99f37fab4d03b9.tar.gz
merge
-rw-r--r--ChangeLog13
-rw-r--r--__pkginfo__.py2
-rw-r--r--adbh.py10
-rw-r--r--debian/changelog6
-rw-r--r--graph.py19
5 files changed, 46 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5dbc478..90b3090 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,20 +2,27 @@ ChangeLog for logilab.common
============================
--
+ * graph: new has_path method
+
+2008-10-01 -- 0.35.2
* configuration:
- fix #6011: lgc.configuration ignore customized option values
- fix #3278: man page generation broken
+
* dropped context.py module which broke the debian package when
some python <2.5 is installed (#5979)
-
-2008-09-10 -- 0.35.0
+
+
+2008-09-10 -- 0.35.0
* fix #5945: wrong edge proporties in graph.DotBackend
* testlib: filter tests with tag decorator
* shellutils: new simple unzip function
-
+
+
+
2008-08-07 -- 0.34.0
* changelog: properly adds new line at the end of each entry
diff --git a/__pkginfo__.py b/__pkginfo__.py
index 1fda9e9..0299169 100644
--- a/__pkginfo__.py
+++ b/__pkginfo__.py
@@ -8,7 +8,7 @@ __docformat__ = "restructuredtext en"
distname = 'logilab-common'
modname = 'common'
-numversion = (0, 35, 0)
+numversion = (0, 35, 2)
version = '.'.join([str(num) for num in numversion])
license = 'GPL'
diff --git a/adbh.py b/adbh.py
index 24c3ab9..2612096 100644
--- a/adbh.py
+++ b/adbh.py
@@ -428,6 +428,16 @@ class _SqliteAdvFuncHelper(_GenericAdvFuncHelper):
ilike_support = False
union_parentheses_support = False
+ def sql_create_index(self, table, column, unique=False):
+ idx = self._index_name(table, column, unique)
+ if unique:
+ return 'CREATE UNIQUE INDEX %s ON %s(%s);' % (idx, table, column)
+ else:
+ return 'CREATE INDEX %s ON %s(%s);' % (idx, table, column)
+
+ def sql_drop_index(self, table, column, unique=False):
+ return 'DROP INDEX %s' % self._index_name(table, column, unique)
+
def list_tables(self, cursor):
"""return the list of tables of a database"""
# filter type='table' else we get indices as well
diff --git a/debian/changelog b/debian/changelog
index 4f90842..952534c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+logilab-common (0.35.2-1) unstable; urgency=low
+
+ * new upstream release
+
+ -- Sylvain Thénault <sylvain.thenault@logilab.fr> Wed, 01 Oct 2008 16:42:01 +0200
+
logilab-common (0.35.0-1) unstable; urgency=low
* new upstream release
diff --git a/graph.py b/graph.py
index 624fa27..a672166 100644
--- a/graph.py
+++ b/graph.py
@@ -175,3 +175,22 @@ def _get_cycles(graph_dict, vertice=None, path=None, result=None):
except KeyError:
pass
path.pop()
+
+def has_path(graph_dict, fromnode, tonode, path=None):
+ """generic function taking a simple graph definition as a dictionary, with
+ node has key associated to a list of nodes directly reachable from it.
+
+ Return None if no path exists to go from `fromnode` to `tonode`, else the
+ first path found
+ """
+ if path is None:
+ path = []
+ elif fromnode in path:
+ return False
+ path.append(fromnode)
+ for destnode in graph_dict[fromnode]:
+ if destnode == tonode or has_path(graph_dict, destnode, tonode, path):
+ return path[1:]
+ path.pop()
+ return None
+