[Pkg-sugar-commit] [sugar-read-activity] 01/01: Avoid shipping binary uninspectable empty sqlite database. Instead create if in code.

Sebastian Silva icarito-guest at moszumanska.debian.org
Sat Jun 27 02:48:44 UTC 2015


This is an automated email from the git hooks/post-receive script.

icarito-guest pushed a commit to branch pull-request-1
in repository sugar-read-activity.

commit f97076bd7531115fee5b0465f27cba4751d93899
Author: Sebastian Silva <sebastian at fuentelibre.org>
Date:   Fri Jun 26 21:45:28 2015 -0500

    Avoid shipping binary uninspectable empty sqlite database. Instead create if in code.
    
    This was important for inclusion in Debian.
---
 read_v1.db | Bin 2048 -> 0 bytes
 readdb.py  |  20 +++++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/read_v1.db b/read_v1.db
deleted file mode 100644
index fac21dd..0000000
Binary files a/read_v1.db and /dev/null differ
diff --git a/readdb.py b/readdb.py
index 28d09f6..473be9f 100644
--- a/readdb.py
+++ b/readdb.py
@@ -45,11 +45,21 @@ def _init_db():
 
     # Situation 1: DB is non-existent at all
     if not os.path.exists(dbpath) and not os.path.exists(olddbpath):
-        try:
-            os.makedirs(dbdir)
-        except:
-            pass
-        shutil.copy(srcpath, dbpath)
+        # in this case, sqlite3 takes care of things
+        conn = sqlite3.connect(dbpath)
+        conn.execute("""
+        CREATE TABLE "bookmarks"(
+              md5 text,
+              page integer,
+              content text,
+              timestamp real,
+              user text,
+              color text,
+              local integer
+            );""")
+        conn.commit()
+        conn.close()
+
         return dbpath
 
     # Situation 2: DB is outdated

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-read-activity.git



More information about the pkg-sugar-commit mailing list