Avoid shipping binary uninspectable empty sqlite database. Instead create if in code.
This was important for inclusion in Debian.
Sebastian Silva authored 8 years ago
Gonzalo Odiard committed 8 years ago
44 | 44 | |
45 | 45 | # Situation 1: DB is non-existent at all |
46 | 46 | if not os.path.exists(dbpath) and not os.path.exists(olddbpath): |
47 | try: | |
48 | os.makedirs(dbdir) | |
49 | except: | |
50 | pass | |
51 | shutil.copy(srcpath, dbpath) | |
47 | # in this case, sqlite3 takes care of things | |
48 | conn = sqlite3.connect(dbpath) | |
49 | conn.execute(""" | |
50 | CREATE TABLE "bookmarks"( | |
51 | md5 text, | |
52 | page integer, | |
53 | content text, | |
54 | timestamp real, | |
55 | user text, | |
56 | color text, | |
57 | local integer | |
58 | );""") | |
59 | conn.commit() | |
60 | conn.close() | |
61 | ||
52 | 62 | return dbpath |
53 | 63 | |
54 | 64 | # Situation 2: DB is outdated |