summaryrefslogtreecommitdiff
path: root/readyaml.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2014-03-08 12:39:32 +0100
committerHelmut Grohne <helmut@subdivi.de>2014-03-08 12:39:32 +0100
commitc6a30cefff55cd247a47fa0a2d4f819592e1202b (patch)
tree58b6ff52bc6827782c2973f1ce976e245ce5f34c /readyaml.py
parent751f19ec1107c9059ae4834e4b757741ebee6cbd (diff)
parentbb0aea9971bc79d8787d8f034022d0ca803fcab3 (diff)
downloaddebian-dedup-c6a30cefff55cd247a47fa0a2d4f819592e1202b.tar.gz
Merge branch 'master' into sqlalchemy
In the mean time, the master branch evolved quite a bit and the schema changed again (eqclass added to function table). The main reason for the merge is to resolve the large amounts of conflicts once, so development of the sqlalchemy branch can continue and still benefit from changes in the master branch such as schema compatibility, adapting the indent level in web app due to the use of contextlib.closing which resembles sqlalchemy's "with db.begin() as conn:". Conflicts: autoimport.py dedup/utils.py readyaml.py update_sharing.py webapp.py
Diffstat (limited to 'readyaml.py')
-rwxr-xr-xreadyaml.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/readyaml.py b/readyaml.py
index 835967d..15cfcb3 100755
--- a/readyaml.py
+++ b/readyaml.py
@@ -2,6 +2,7 @@
"""This tool reads a yaml file as generated by importpkg.py on stdin and
updates the database with the contents."""
+import optparse
import sys
from debian.debian_support import version_compare
@@ -57,7 +58,12 @@ def readyaml(conn, stream):
raise ValueError("missing commit block")
def main():
- db = sqlalchemy.create_engine("sqlite:///test.sqlite3")
+ parser = optparse.OptionParser()
+ parser.add_option("-d", "--database", action="store",
+ default="sqlite:///test.sqlite3",
+ help="location of the database")
+ options, args = parser.parse_args()
+ db = sqlalchemy.create_engine(options.database)
enable_sqlite_foreign_keys(db)
with db.begin() as conn:
readyaml(conn, sys.stdin)