From 0833b2d8ce6cfeb09a7d985d7b81ee87ae499e2d Mon Sep 17 00:00:00 2001 From: Filippo Giunchedi Date: Sun, 30 Nov 2008 01:16:46 +0100 Subject: [PATCH] add datadir option --- queue_rss.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/queue_rss.py b/queue_rss.py index 0946fece..2e92dd29 100755 --- a/queue_rss.py +++ b/queue_rss.py @@ -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)) -- 2.39.5