diff options
author | Anthony Baxter <anthonybaxter@gmail.com> | 2006-04-01 08:36:27 (GMT) |
---|---|---|
committer | Anthony Baxter <anthonybaxter@gmail.com> | 2006-04-01 08:36:27 (GMT) |
commit | 07f5b35e190ab9be85143c6e8e1217d96bbf75ca (patch) | |
tree | 828ae2c9574ca54383e516403fec91352349ea2b /setup.py | |
parent | 7f6b67c2359d9b52b2eabc1e2ccff4cedb5c78b7 (diff) | |
download | cpython-07f5b35e190ab9be85143c6e8e1217d96bbf75ca.zip cpython-07f5b35e190ab9be85143c6e8e1217d96bbf75ca.tar.gz cpython-07f5b35e190ab9be85143c6e8e1217d96bbf75ca.tar.bz2 |
backport r243 from the pysqlite2 svn repository - lowers the required version
of SQLite3 from 3.2.2 to 3.0.8, by providing an alternative to
sqlite3_transfer_bindings. setup.py also handles the common (in debian
and ubuntu, at least) case of a buggy sqlite3.h SQLITE_VERSION_NUMBER.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 24 |
1 files changed, 20 insertions, 4 deletions
@@ -690,6 +690,7 @@ class PyBuildExt(build_ext): dblib_dir = None # The sqlite interface + sqlite_setup_debug = True # verbose debug prints from this script? # We hunt for "#define SQLITE_VERSION_NUMBER nnnnn" # We need to find a version >= 3002002 (> sqlite version 3.2.2) @@ -701,22 +702,37 @@ class PyBuildExt(build_ext): '/usr/local/include/sqlite', '/usr/local/include/sqlite3', ] - MIN_SQLITE_VERSION = 3002002 + MIN_SQLITE_VERSION_NUMBER = 3000008 + MIN_SQLITE_VERSION = "3.0.8" for d in sqlite_inc_paths + inc_dirs: f = os.path.join(d, "sqlite3.h") if os.path.exists(f): - if db_setup_debug: print "found %s"%f + if sqlite_setup_debug: print "sqlite: found %s"%f f = open(f).read() m = re.search(r"#define\WSQLITE_VERSION_NUMBER\W(\d+)", f) if m: sqlite_version = int(m.group(1)) - if sqlite_version >= MIN_SQLITE_VERSION: + if sqlite_version >= MIN_SQLITE_VERSION_NUMBER: # we win! print "%s/sqlite3.h: version %s"%(d, sqlite_version) sqlite_incdir = d break + elif sqlite_version == 3000000: + # Bug in a common version out there where + # SQLITE_VERSION_NUMBER was set incorrectly + if sqlite_setup_debug: + print "found buggy SQLITE_VERSION_NUMBER, checking" + m = re.search(r'#define\WSQLITE_VERSION\W+"([\.\d]+)"', + f) + if m: + sqlite_version = m.group(1) + if sqlite_version >= MIN_SQLITE_VERSION: + print "%s/sqlite3.h: version %s"%(d, + sqlite_version) + sqlite_incdir = d + break else: - if db_setup_debug: + if sqlite_setup_debug: print "%s: version %d is too old, need >= %s"%(d, sqlite_version, MIN_SQLITE_VERSION) |