]> git.decadent.org.uk Git - dak.git/blobdiff - charisma
renamed to kelly.foo
[dak.git] / charisma
index 2e801dc743d6b666710bc8e7ee571cf30a3b016e..cc352dc1a838fb6a597258df014c13dc1e3b63c1 100755 (executable)
--- a/charisma
+++ b/charisma
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
 
 # Generate Maintainers file used by e.g. the Debian Bug Tracking System
-# Copyright (C) 2000, 2001  James Troup <james@nocrew.org>
-# $Id: charisma,v 1.10 2001-09-26 03:47:15 troup Exp $
+# Copyright (C) 2000, 2001, 2002  James Troup <james@nocrew.org>
+# $Id: charisma,v 1.14 2002-05-03 16:06:45 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
@@ -26,9 +26,9 @@
 
 ################################################################################
 
-import os, pg, re, string, sys
-import db_access, utils
-import apt_pkg
+import pg, string, sys;
+import db_access, utils;
+import apt_pkg;
 
 ################################################################################
 
@@ -39,9 +39,12 @@ packages = {}
 fixed_maintainer_cache = {}
 
 ################################################################################
-def usage (exit_code):
+
+def usage (exit_code=0):
     print """Usage: charisma [OPTION] EXTRA_FILE[...]
 Generate an index of packages <=> Maintainers.
+
+  -h, --help                 show this help and exit
 """
     sys.exit(exit_code)
 
@@ -73,14 +76,18 @@ def get_maintainer_from_source (source_id):
 def main():
     global Cnf, projectB;
 
-    apt_pkg.init();
+    Cnf = utils.get_conf()
+
+    Arguments = [('h',"help","Charisma::Options::Help")];
+    if not Cnf.has_key("Charisma::Options::Help"):
+       Cnf["Charisma::Options::Help"] = "";
 
-    Cnf = apt_pkg.newConfiguration();
-    apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
+    extra_files = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
+    Options = Cnf.SubTree("Charisma::Options");
 
-    extra_files = apt_pkg.ParseCommandLine(Cnf,[],sys.argv);
+    if Options["Help"]:
+        usage();
 
-    #projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]), None, None, Cnf["DB::ROUser"]);
     projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]));
     db_access.init(Cnf, projectB);