summaryrefslogtreecommitdiff
path: root/scripts/testing/check-pysqlcipher.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/testing/check-pysqlcipher.py')
-rwxr-xr-xscripts/testing/check-pysqlcipher.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/testing/check-pysqlcipher.py b/scripts/testing/check-pysqlcipher.py
new file mode 100755
index 00000000..4202b13b
--- /dev/null
+++ b/scripts/testing/check-pysqlcipher.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import os
+import tempfile
+
+from pysqlcipher import dbapi2
+
+
+def have_usleep():
+ fname = tempfile.mktemp()
+ db = dbapi2.connect(fname)
+ cursor = db.cursor()
+ cursor.execute('PRAGMA compile_options;')
+ options = map(lambda t: t[0], cursor.fetchall())
+ db.close()
+ os.unlink(fname)
+ return u'HAVE_USLEEP' in options
+
+
+if __name__ == '__main__':
+ if not have_usleep():
+ raise Exception('pysqlcipher was not built with HAVE_USLEEP flag.')
+ print "All ok, pysqlcipher was built with HAVE_USLEEP flag. :-)"