Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: tools/lua/gradients.py

Issue 2103973002: Changes to Lua gradient scraping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/utils/SkLua.cpp ('K') | « tools/lua/gradients.lua ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lua/gradients.py
diff --git a/tools/lua/gradients.py b/tools/lua/gradients.py
new file mode 100755
index 0000000000000000000000000000000000000000..97f9335e6a239281a68029d13b8ef8653a812bb3
--- /dev/null
+++ b/tools/lua/gradients.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+#
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import argparse
+import sqlite3
+
+def create_database(inpath, outpath):
+ with sqlite3.connect(outpath) as conn:
+ c = conn.cursor();
+ c.execute('''CREATE TABLE IF NOT EXISTS gradients (
+ ColorCount INTEGER,
+ GradientType TEXT,
+ TileMode TEXT,
+ EvenlySpaced INTEGER,
+ HardStops INTEGER
+ )''');
+ c.execute("DELETE FROM gradients");
+
+ with open(inpath, "r") as results:
+ gradients = []
+ for line in [line.strip() for line in results]:
+ gradients.append(line.split());
+
+ c.executemany("INSERT INTO gradients VALUES (?, ?, ?, ?, ?)",
+ gradients);
+
+ conn.commit();
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ description = "Transform Lua script output to a SQL DB");
+ parser.add_argument("inpath", help="Path to Lua script output file");
+ parser.add_argument("outpath", help="Path to SQL DB");
+ args = parser.parse_args();
+
+ create_database(args.inpath, args.outpath);
« src/utils/SkLua.cpp ('K') | « tools/lua/gradients.lua ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698