Bug 584474 part 10 - Make expandlibs_exec.py less verbose by default. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 04 Mar 2011 17:25:41 +0100
changeset 63492 cb0f1dcf6fae19267a3c78f25fa9db068fc5e205
parent 63491 d5ac43a73050a97233cd70df14c5cd2cfb234fc2
child 63493 f1b4371344d9efa7041a2e7af8253e49f960f3c4
push idunknown
push userunknown
push dateunknown
reviewersted
bugs584474
milestone2.0b13pre
Bug 584474 part 10 - Make expandlibs_exec.py less verbose by default. r=ted
config/expandlibs_exec.py
js/src/config/expandlibs_exec.py
--- a/config/expandlibs_exec.py
+++ b/config/expandlibs_exec.py
@@ -126,27 +126,30 @@ class ExpandArgsMore(ExpandArgs):
         self[0:] = newlist
 
 def main():
     parser = OptionParser()
     parser.add_option("--extract", action="store_true", dest="extract",
         help="when a library has no descriptor file, extract it first, when possible")
     parser.add_option("--uselist", action="store_true", dest="uselist",
         help="use a list file for objects when executing a command")
+    parser.add_option("--verbose", action="store_true", dest="verbose",
+        help="display executed command and temporary files content")
 
     (options, args) = parser.parse_args()
 
     with ExpandArgsMore(args) as args:
         if options.extract:
             args.extract()
         if options.uselist:
             args.makelist()
 
-        print >>sys.stderr, "Executing: " + " ".join(args)
-        for tmp in [f for f in args.tmp if os.path.isfile(f)]:
-            print >>sys.stderr, tmp + ":"
-            with open(tmp) as file:
-                print >>sys.stderr, "".join(["    " + l for l in file.readlines()])
-        sys.stderr.flush()
+        if options.verbose:
+            print >>sys.stderr, "Executing: " + " ".join(args)
+            for tmp in [f for f in args.tmp if os.path.isfile(f)]:
+                print >>sys.stderr, tmp + ":"
+                with open(tmp) as file:
+                    print >>sys.stderr, "".join(["    " + l for l in file.readlines()])
+            sys.stderr.flush()
         exit(subprocess.call(args))
 
 if __name__ == '__main__':
     main()
--- a/js/src/config/expandlibs_exec.py
+++ b/js/src/config/expandlibs_exec.py
@@ -126,27 +126,30 @@ class ExpandArgsMore(ExpandArgs):
         self[0:] = newlist
 
 def main():
     parser = OptionParser()
     parser.add_option("--extract", action="store_true", dest="extract",
         help="when a library has no descriptor file, extract it first, when possible")
     parser.add_option("--uselist", action="store_true", dest="uselist",
         help="use a list file for objects when executing a command")
+    parser.add_option("--verbose", action="store_true", dest="verbose",
+        help="display executed command and temporary files content")
 
     (options, args) = parser.parse_args()
 
     with ExpandArgsMore(args) as args:
         if options.extract:
             args.extract()
         if options.uselist:
             args.makelist()
 
-        print >>sys.stderr, "Executing: " + " ".join(args)
-        for tmp in [f for f in args.tmp if os.path.isfile(f)]:
-            print >>sys.stderr, tmp + ":"
-            with open(tmp) as file:
-                print >>sys.stderr, "".join(["    " + l for l in file.readlines()])
-        sys.stderr.flush()
+        if options.verbose:
+            print >>sys.stderr, "Executing: " + " ".join(args)
+            for tmp in [f for f in args.tmp if os.path.isfile(f)]:
+                print >>sys.stderr, tmp + ":"
+                with open(tmp) as file:
+                    print >>sys.stderr, "".join(["    " + l for l in file.readlines()])
+            sys.stderr.flush()
         exit(subprocess.call(args))
 
 if __name__ == '__main__':
     main()