]> git.decadent.org.uk Git - dak.git/commitdiff
[PATCH] Add option to make-maintainers to print data to stdout
authorMatthias Klumpp <mak@debian.org>
Tue, 26 Mar 2013 22:32:52 +0000 (23:32 +0100)
committerJoerg Jaspert <joerg@debian.org>
Thu, 10 Sep 2015 20:27:13 +0000 (22:27 +0200)
Add option which makes make-maintainer print the maintainer data to
stdout instead of writing it to files.

dak/make_maintainers.py

index 4c7d3c9d1c17971b9450f17f6fc3b86d457e00df..7387e8ed7f6fb4ae8d84f4764b4e689bb2c363e3 100755 (executable)
@@ -48,6 +48,7 @@ Generate an index of packages <=> Maintainers / Uploaders.
 
   -a, --archive=ARCHIVE      archive to take packages from
   -s, --source               output source packages only
+  -p, --print                print package list to stdout instead of writing it to files
   -h, --help                 show this help and exit
 """
     sys.exit(exit_code)
@@ -71,8 +72,9 @@ def main():
 
     Arguments = [('h',"help","Make-Maintainers::Options::Help"),
                  ('a',"archive","Make-Maintainers::Options::Archive",'HasArg'),
-                 ('s',"source","Make-Maintainers::Options::Source")]
-    for i in ["Help", "Source" ]:
+                 ('s',"source","Make-Maintainers::Options::Source"),
+                 ('p',"print","Make-Maintainers::Options::Print")]
+    for i in ["Help", "Source", "Print" ]:
         if not cnf.has_key("Make-Maintainers::Options::%s" % (i)):
             cnf["Make-Maintainers::Options::%s" % (i)] = ""
 
@@ -133,17 +135,22 @@ def main():
             maintainers[package] = maintainer
             uploaders[package] = [maintainer]
 
-    maintainer_file = open('Maintainers', 'w')
-    uploader_file = open('Uploaders', 'w')
-    for package in sorted(uploaders):
-        maintainer_file.write(format(package, maintainers[package]))
-        for uploader in uploaders[package]:
-            uploader_file.write(format(package, uploader))
-    uploader_file.close()
-    maintainer_file.close()
-    Logger.close()
-
-################################################################################
+    if Options["Print"]:
+        for package in sorted(maintainers):
+            sys.stdout.write(format(package, maintainers[package]))
+    else:
+        maintainer_file = open('Maintainers', 'w')
+        uploader_file = open('Uploaders', 'w')
+        for package in sorted(uploaders):
+            maintainer_file.write(format(package, maintainers[package]))
+            for uploader in uploaders[package]:
+                uploader_file.write(format(package, uploader))
+        uploader_file.close()
+        maintainer_file.close()
+
+        Logger.close()
+
+###############################################################################
 
 if __name__ == '__main__':
     main()