]> git.decadent.org.uk Git - dak.git/commitdiff
add datadir option
authorFilippo Giunchedi <filippo@esaurito.net>
Sun, 30 Nov 2008 00:16:46 +0000 (01:16 +0100)
committerFilippo Giunchedi <filippo@esaurito.net>
Sun, 30 Nov 2008 00:16:46 +0000 (01:16 +0100)
queue_rss.py

index 0946fece59923ddb065a8c317148752573cc191d..2e92dd29fc07f8b9fc620eb87fa99cdc434b15e2 100755 (executable)
@@ -20,12 +20,14 @@ outrss_filename = "changes_out.rss"
 db_filename = "status.db"
 
 parser = OptionParser()
-parser.set_defaults(queuedir="queue", outdir="out", max_entries="30")
+parser.set_defaults(queuedir="queue", outdir="out", datadir="status", max_entries="30")
 
 parser.add_option("-q", "--queuedir", dest="queuedir",
         help="The queue dir (%default)")
 parser.add_option("-o", "--outdir", dest="outdir",
         help="The output directory (%default)")
+parser.add_option("-d", "--datadir", dest="datadir",
+        help="The data dir (%default)")
 parser.add_option("-m", "--max-entries", dest="max_entries", type="int",
         help="Max number of entries to keep (%default)")
 
@@ -149,7 +151,11 @@ if __name__ == "__main__":
         sys.stderr.write("Outdir '%s' does not exists\n" % settings.outdir)
         sys.exit(1)
 
-    status_db = os.path.join(settings.outdir, db_filename)
+    if not os.path.exists(settings.datadir):
+        sys.stderr.write("Datadir '%s' does not exists\n" % settings.datadir)
+        sys.exit(1)
+
+    status_db = os.path.join(settings.datadir, db_filename)
 
     try:
         status = cPickle.load(open(status_db))