summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorrichard <devnull@localhost>2010-07-24 10:55:59 +0000
committerrichard <devnull@localhost>2010-07-24 10:55:59 +0000
commitf1dc4b0a9cba691cf43814fc5223d0ff0c5ee475 (patch)
tree50e02a7f5940ddb16a76c82233ba5ae56708a6e2 /tools
parent18f0aec7b3efd1c3446dfca5362638a249f99079 (diff)
downloaddecorator-f1dc4b0a9cba691cf43814fc5223d0ff0c5ee475.tar.gz
rename for convenience
Diffstat (limited to 'tools')
-rwxr-xr-xtools/mksqlite.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/mksqlite.py b/tools/mksqlite.py
new file mode 100755
index 0000000..7ca5665
--- /dev/null
+++ b/tools/mksqlite.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+import os
+dbpath = "packages.db"
+
+if os.path.exists(dbpath):
+ print "Remove",dbpath,"first"
+ raise SystemExit
+
+print "Creating database", dbpath
+sqlite = os.popen('sqlite3 '+dbpath, "w")
+passthrough = True
+for line in open('pkgbase_schema.sql'):
+ if 'nosqlite-end' in line:
+ # end of disabled block
+ passthrough = True
+ print >>sqlite
+ continue
+ if 'nosqlite' in line:
+ passthrough = False
+ print >>sqlite
+ continue
+ if not passthrough:
+ print >> sqlite
+ continue
+ # make sqlite happy: SERIAL is not a valid type
+ sqlite.write(line.replace('SERIAL PRIMARY KEY', 'INTEGER PRIMARY KEY'))
+sqlite.close()