aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2020-11-30 09:52:13 +0200
committerMatti Picus <matti.picus@gmail.com>2020-11-30 09:52:13 +0200
commit7b63677b29146f2eb3c2a2ea68f804a3f0edfa91 (patch)
tree769a3d0835e6e3844c4cbec2cbe0bc3972fa9936 /lib_pypy
parentmerge win64 into default (diff)
downloadpypy-7b63677b29146f2eb3c2a2ea68f804a3f0edfa91.tar.gz
pypy-7b63677b29146f2eb3c2a2ea68f804a3f0edfa91.tar.bz2
pypy-7b63677b29146f2eb3c2a2ea68f804a3f0edfa91.zip
when building cffi extension, copy dll for sqlite3.dll so tests will find it
Diffstat (limited to 'lib_pypy')
-rw-r--r--lib_pypy/_sqlite3_build.py24
-rw-r--r--lib_pypy/_ssl_build.py4
2 files changed, 24 insertions, 4 deletions
diff --git a/lib_pypy/_sqlite3_build.py b/lib_pypy/_sqlite3_build.py
index 07397eb71f..fb03aeecd9 100644
--- a/lib_pypy/_sqlite3_build.py
+++ b/lib_pypy/_sqlite3_build.py
@@ -246,16 +246,17 @@ def _has_load_extension():
if _has_load_extension():
_ffi.cdef("int sqlite3_enable_load_extension(sqlite3 *db, int onoff);")
+libraries=['sqlite3']
if sys.platform.startswith('freebsd'):
_localbase = os.environ.get('LOCALBASE', '/usr/local')
extra_args = dict(
- libraries=['sqlite3'],
+ libraries=libraries,
include_dirs=[os.path.join(_localbase, 'include')],
library_dirs=[os.path.join(_localbase, 'lib')]
)
else:
extra_args = dict(
- libraries=['sqlite3']
+ libraries=libraries,
)
_ffi.set_source("_sqlite3_cffi", "#include <sqlite3.h>", **extra_args)
@@ -263,3 +264,22 @@ _ffi.set_source("_sqlite3_cffi", "#include <sqlite3.h>", **extra_args)
if __name__ == "__main__":
_ffi.compile()
+ if sys.platform == 'win32':
+ # copy dlls from externals to the pwd
+ # maybe we should link to libraries instead of the dlls
+ # to avoid this mess
+ import os, glob, shutil
+ path_parts = os.environ['PATH'].split(';')
+ candidates = [x for x in path_parts if 'externals' in x]
+
+ def copy_from_path(dll):
+ for c in candidates:
+ files = glob.glob(os.path.join(c, dll + '*.dll'))
+ if files:
+ for fname in files:
+ print('copying', fname)
+ shutil.copy(fname, '.')
+
+ if candidates:
+ for lib in libraries:
+ copy_from_path(lib)
diff --git a/lib_pypy/_ssl_build.py b/lib_pypy/_ssl_build.py
index 73278ebfe0..ed59270252 100644
--- a/lib_pypy/_ssl_build.py
+++ b/lib_pypy/_ssl_build.py
@@ -61,7 +61,7 @@ if __name__ == '__main__':
ffi.compile(verbose=True)
if sys.platform == 'win32':
# copy dlls from externals to the pwd
- # maybe we should link _ssl to libraries instead of the dlls
+ # maybe we should link to libraries instead of the dlls
# to avoid this mess
import os, glob, shutil
path_parts = os.environ['PATH'].split(';')
@@ -77,4 +77,4 @@ if __name__ == '__main__':
if candidates:
for lib in libraries:
- copy_from_path(lib)
+ copy_from_path(lib)