]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
patman: Adjust command.Output() to raise an error by default
authorSimon Glass <sjg@chromium.org>
Tue, 26 Jul 2016 00:59:00 +0000 (18:59 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 19 Sep 2016 03:04:38 +0000 (21:04 -0600)
It is more useful to have this method raise an error when something goes
wrong. Make this the default and adjust the few callers that don't want to
use it this way.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/buildman/control.py
tools/patman/checkpatch.py
tools/patman/command.py
tools/patman/gitutil.py

index b86d7b3c1f901f2598778e0b94e4543d863fe758..0b6ab03b4c3ad270cd5f5efd521c916d18fa1148 100644 (file)
@@ -237,7 +237,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
         options.step = len(series.commits) - 1
 
     gnu_make = command.Output(os.path.join(options.git,
-                                           'scripts/show-gnu-make')).rstrip()
+            'scripts/show-gnu-make'), raise_on_error=False).rstrip()
     if not gnu_make:
         sys.exit('GNU Make not found')
 
index 34a3bd22b08d274b665d2fcf4c47fd17629a92dc..3eef6de221062894d2a4c5551c2009e68fed7d00 100644 (file)
@@ -63,7 +63,8 @@ def CheckPatch(fname, verbose=False):
     result.problems = []
     chk = FindCheckPatch()
     item = {}
-    result.stdout = command.Output(chk, '--no-tree', fname)
+    result.stdout = command.Output(chk, '--no-tree', fname,
+                                   raise_on_error=False)
     #pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE)
     #stdout, stderr = pipe.communicate()
 
index d586f1115866125f5768fe0971cb28474c970685..d1f0ca505c07f389e3abe0d5e76405b27035f605 100644 (file)
@@ -104,8 +104,9 @@ def RunPipe(pipe_list, infile=None, outfile=None,
         raise Exception("Error running '%s'" % user_pipestr)
     return result
 
-def Output(*cmd):
-    return RunPipe([cmd], capture=True, raise_on_error=False).stdout
+def Output(*cmd, **kwargs):
+    raise_on_error = kwargs.get('raise_on_error', True)
+    return RunPipe([cmd], capture=True, raise_on_error=raise_on_error).stdout
 
 def OutputOneLine(*cmd, **kwargs):
     raise_on_error = kwargs.pop('raise_on_error', True)
index e088baeb819e3895bcec5277e1f011d493904fbd..bb7c9e08bc2c3a50a4b9a6435e1fa345a9c5f651 100644 (file)
@@ -391,7 +391,8 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
     """
     to = BuildEmailList(series.get('to'), '--to', alias, raise_on_error)
     if not to:
-        git_config_to = command.Output('git', 'config', 'sendemail.to')
+        git_config_to = command.Output('git', 'config', 'sendemail.to',
+                                       raise_on_error=False)
         if not git_config_to:
             print ("No recipient.\n"
                    "Please add something like this to a commit\n"