[pypy-commit] pypy default: on windows, search for sqlite3.dll first next to the exe, then on the path, fixes packaged pypy 'import sqlite3'

mattip noreply at buildbot.pypy.org
Mon Apr 8 18:47:52 CEST 2013


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r63145:341a34c7d62f
Date: 2013-04-08 19:44 +0300
http://bitbucket.org/pypy/pypy/changeset/341a34c7d62f/

Log:	on windows, search for sqlite3.dll first next to the exe, then on
	the path, fixes packaged pypy 'import sqlite3'

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -256,7 +256,12 @@
     typedef ... sqlite3;
     int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
     """)
-    unverified_lib = unverified_ffi.dlopen('sqlite3')
+    libname = 'sqlite3'
+    if sys.platform == 'win32':
+        _libname = os.path.join(os.path.dirname(sys.executable), libname)
+        if os.path.exists(_libname + '.dll'):
+            libname = _libname
+    unverified_lib = unverified_ffi.dlopen(libname)
     return hasattr(unverified_lib, 'sqlite3_enable_load_extension')
 
 if _has_load_extension():


More information about the pypy-commit mailing list