#!/usr/bin/env python
# Produces a report on NEW and BYHAND packages
-# Copyright (C) 2001, 2002 James Troup <james@nocrew.org>
-# $Id: helena,v 1.3 2002-12-08 17:25:47 troup Exp $
+# Copyright (C) 2001, 2002, 2003 James Troup <james@nocrew.org>
+# $Id: helena,v 1.5 2003-07-15 17:29:26 troup Exp $
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
################################################################################
-def plural (x):
+def usage(exit_code=0):
+ print """Usage: helena
+Prints a report of packages in queue directories (usually new and byhand).
+
+ -h, --help show this help and exit."""
+ sys.exit(exit_code)
+
+################################################################################
+
+def plural(x):
if x > 1:
return "s";
else:
unit="month";
else:
x /= 29030400;
- unit="years";
+ unit="year";
x = int(x);
return "%s %s%s" % (x, unit, plural(x));
global Cnf, Katie;
Cnf = utils.get_conf();
- apt_pkg.ParseCommandLine(Cnf,[],sys.argv);
+ Arguments = [('h',"help","Helena::Options::Help")];
+ for i in [ "help" ]:
+ if not Cnf.has_key("Helena::Options::%s" % (i)):
+ Cnf["Helena::Options::%s" % (i)] = "";
+
+ apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv);
+
+ Options = Cnf.SubTree("Helena::Options")
+ if Options["Help"]:
+ usage();
+
Katie = katie.Katie(Cnf);
directories = Cnf.ValueList("Helena::Directories");
if not directories:
- directories = [ "byhand", "new"]
+ directories = [ "byhand", "new" ];
for directory in directories:
changes_files = glob.glob("%s/*.changes" % (Cnf["Dir::Queue::%s" % (directory)]));