Rev 453: Check system and installed pysqlite's sqlite versions. in file:///home/jelmer/bzr-svn/0.3/

Jelmer Vernooij jelmer at samba.org
Sun May 20 22:31:45 BST 2007


At file:///home/jelmer/bzr-svn/0.3/

------------------------------------------------------------
revno: 453
revision-id: jelmer at samba.org-20070520213144-u3ot57hw58kaj258
parent: jelmer at samba.org-20070517164947-xfgirmo8bkdaf1g3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-05-20 22:31:44 +0100
message:
  Check system and installed pysqlite's sqlite versions.
added:
  cache.py                       cache.py-20070520185908-qbtlcet08bllgs0f-1
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  README                         README-20051120210643-bd274a2fef9aed6a
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
=== added file 'cache.py'
--- a/cache.py	1970-01-01 00:00:00 +0000
+++ b/cache.py	2007-05-20 21:31:44 +0000
@@ -0,0 +1,61 @@
+# Copyright (C) 2006-2007 Jelmer Vernooij <jelmer at samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+"""Subversion cache directory access."""
+
+import bzrlib
+from bzrlib.config import config_dir, ensure_config_dir_exists
+from bzrlib.trace import warning
+
+import os
+
+def create_cache_dir():
+    ensure_config_dir_exists()
+    cache_dir = os.path.join(config_dir(), 'svn-cache')
+
+    if not os.path.exists(cache_dir):
+        os.mkdir(cache_dir)
+
+        open(os.path.join(cache_dir, "README"), 'w').write(
+"""This directory contains information cached by the bzr-svn plugin.
+
+It is used for performance reasons only and can be removed 
+without losing data.
+
+See http://bazaar-vcs.org/BzrSvn for details.
+""")
+    return cache_dir
+
+def check_pysqlite_version(sqlite3):
+    """Check that sqlite library is compatible.
+
+    """
+    if (sqlite3.sqlite_version_info[0] < 3 or 
+            (sqlite3.sqlite_version_info[0] == 3 and 
+             sqlite3.sqlite_version_info[1] < 3)):
+        warning('Needs at least sqlite 3.3.x')
+        raise bzrlib.errors.BzrError("incompatible sqlite library")
+
+try:
+    try:
+        import sqlite3
+        check_pysqlite_version(sqlite3)
+    except ImportError, bzrlib.errors.BzrError:
+        from pysqlite2 import dbapi2 as sqlite3
+        check_pysqlite_version(sqlite3)
+except:
+    warning('Needs at least Python2.5 or Python2.4 with the pysqlite2 '
+            'module')
+    raise bzrlib.errors.BzrError("missing sqlite library")

=== modified file 'NEWS'
--- a/NEWS	2007-05-16 10:53:10 +0000
+++ b/NEWS	2007-05-20 21:31:44 +0000
@@ -1,5 +1,10 @@
 bzr-svn 0.3.4	UNRELEASED
 
+  BUG FIXES
+
+  * Check for a working pysqlite, rather than checking that the 
+    first one found works. (#115026)
+
 bzr-svn 0.3.3	2007-04-29
 
   IMPROVEMENTS

=== modified file 'README'
--- a/README	2007-05-16 18:18:31 +0000
+++ b/README	2007-05-20 21:31:44 +0000
@@ -4,7 +4,11 @@
 
 This directory contains a simple plugin that adds 
 Subversion (http://subversion.tigris.org/) branch support to 
-Bazaar (http://www.bazaar-vcs.org/)
+Bazaar (http://www.bazaar-vcs.org/). This allows ``bzr branch``, ``bzr push``, 
+``bzr pull``, and ``bzr co`` to work directly against Subversion repositories.
+
+The plugin can at the moment be used to commit to, pull from, merge from, push 
+to and view logs of Subversion branches from Bazaar.
 
 ============
 Dependencies

=== modified file '__init__.py'
--- a/__init__.py	2007-05-16 10:53:10 +0000
+++ b/__init__.py	2007-05-20 21:31:44 +0000
@@ -59,29 +59,8 @@
                 'bindings. See the bzr-svn README for details.')
         raise bzrlib.errors.BzrError("incompatible python subversion bindings")
 
-def check_pysqlite_version():
-    """Check that sqlite library is compatible.
-
-    """
-    try:
-        try:
-            import sqlite3
-        except ImportError:
-            from pysqlite2 import dbapi2 as sqlite3
-    except:
-        warning('Needs at least Python2.5 or Python2.4 with the pysqlite2 '
-                'module')
-        raise bzrlib.errors.BzrError("missing sqlite library")
-
-    if (sqlite3.sqlite_version_info[0] < 3 or 
-            (sqlite3.sqlite_version_info[0] == 3 and 
-             sqlite3.sqlite_version_info[1] < 3)):
-        warning('Needs at least sqlite 3.3.x')
-        raise bzrlib.errors.BzrError("incompatible sqlite library")
-
 check_bzrlib_version(COMPATIBLE_BZR_VERSIONS)
 check_subversion_version()
-check_pysqlite_version()
 
 import branch
 import convert

=== modified file 'logwalker.py'
--- a/logwalker.py	2007-05-17 16:49:47 +0000
+++ b/logwalker.py	2007-05-20 21:31:44 +0000
@@ -26,10 +26,7 @@
 
 import base64
 
-try:
-    import sqlite3
-except ImportError:
-    from pysqlite2 import dbapi2 as sqlite3
+from cache import sqlite3
 
 def _escape_commit_message(message):
     """Replace xml-incompatible control characters."""

=== modified file 'repository.py'
--- a/repository.py	2007-05-17 16:49:47 +0000
+++ b/repository.py	2007-05-20 21:31:44 +0000
@@ -17,7 +17,6 @@
 
 import bzrlib
 from bzrlib.branch import BranchCheckResult
-from bzrlib.config import config_dir, ensure_config_dir_exists
 from bzrlib.errors import (InvalidRevisionId, NoSuchRevision, 
                            NotBranchError, UninitializableFormat)
 from bzrlib.inventory import Inventory
@@ -33,12 +32,9 @@
 import svn.core
 
 import os
-try:
-    import sqlite3
-except ImportError:
-    from pysqlite2 import dbapi2 as sqlite3
 
 from branchprops import BranchPropertyList
+from cache import create_cache_dir, sqlite3
 import errors
 import logwalker
 from tree import SvnRevisionTree
@@ -131,24 +127,6 @@
     return "%s:/%s:%d" % (uuid, branch, revnum)
 
 
-def create_cache_dir():
-    ensure_config_dir_exists()
-    cache_dir = os.path.join(config_dir(), 'svn-cache')
-
-    if not os.path.exists(cache_dir):
-        os.mkdir(cache_dir)
-
-        open(os.path.join(cache_dir, "README"), 'w').write(
-"""This directory contains information cached by the bzr-svn plugin.
-
-It is used for performance reasons only and can be removed 
-without losing data.
-
-See http://bazaar-vcs.org/BzrSvn for details.
-""")
-    return cache_dir
-
-
 class SvnRepositoryFormat(RepositoryFormat):
     rich_root_data = False
 




More information about the bazaar-commits mailing list