diff options
author | Tom Rini <trini@konsulko.com> | 2022-02-10 09:02:06 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-02-10 09:19:44 -0500 |
commit | 2ccd2bc8c3580e00c51094c5cc2b3e2ead8d35c3 (patch) | |
tree | 4e7349b8831fee4b342a971025273d3cd042a2f9 /tools/patman/command.py | |
parent | 6662e5e406fdee26ba981dd4af3308f51f254f0a (diff) | |
parent | f3078d4ea707931c2307a623ecf6e4d215b413d5 (diff) |
Merge tag 'dm-pull-8feb22-take3' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
patman snake-case conversion
binman fit improvements
ACPI fixes and making MCFG available to ARM
[trini: Update scripts/pylint.base]
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools/patman/command.py')
-rw-r--r-- | tools/patman/command.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tools/patman/command.py b/tools/patman/command.py index d54b1e0efce..24358784f26 100644 --- a/tools/patman/command.py +++ b/tools/patman/command.py @@ -32,7 +32,7 @@ class CommandResult: self.return_code = return_code self.exception = exception - def ToOutput(self, binary): + def to_output(self, binary): if not binary: self.stdout = self.stdout.decode('utf-8') self.stderr = self.stderr.decode('utf-8') @@ -43,11 +43,11 @@ class CommandResult: # This permits interception of RunPipe for test purposes. If it is set to # a function, then that function is called with the pipe list being # executed. Otherwise, it is assumed to be a CommandResult object, and is -# returned as the result for every RunPipe() call. +# returned as the result for every run_pipe() call. # When this value is None, commands are executed as normal. test_result = None -def RunPipe(pipe_list, infile=None, outfile=None, +def run_pipe(pipe_list, infile=None, outfile=None, capture=False, capture_stderr=False, oneline=False, raise_on_error=True, cwd=None, binary=False, output_func=None, **kwargs): @@ -104,11 +104,11 @@ def RunPipe(pipe_list, infile=None, outfile=None, if raise_on_error: raise Exception("Error running '%s': %s" % (user_pipestr, str)) result.return_code = 255 - return result.ToOutput(binary) + return result.to_output(binary) if capture: result.stdout, result.stderr, result.combined = ( - last_pipe.CommunicateFilter(output_func)) + last_pipe.communicate_filter(output_func)) if result.stdout and oneline: result.output = result.stdout.rstrip(b'\r\n') result.return_code = last_pipe.wait() @@ -116,13 +116,13 @@ def RunPipe(pipe_list, infile=None, outfile=None, result.return_code = os.waitpid(last_pipe.pid, 0)[1] if raise_on_error and result.return_code: raise Exception("Error running '%s'" % user_pipestr) - return result.ToOutput(binary) + return result.to_output(binary) -def Output(*cmd, **kwargs): +def output(*cmd, **kwargs): kwargs['raise_on_error'] = kwargs.get('raise_on_error', True) - return RunPipe([cmd], capture=True, **kwargs).stdout + return run_pipe([cmd], capture=True, **kwargs).stdout -def OutputOneLine(*cmd, **kwargs): +def output_one_line(*cmd, **kwargs): """Run a command and output it as a single-line string The command us expected to produce a single line of output @@ -131,15 +131,15 @@ def OutputOneLine(*cmd, **kwargs): String containing output of command """ raise_on_error = kwargs.pop('raise_on_error', True) - result = RunPipe([cmd], capture=True, oneline=True, + result = run_pipe([cmd], capture=True, oneline=True, raise_on_error=raise_on_error, **kwargs).stdout.strip() return result -def Run(*cmd, **kwargs): - return RunPipe([cmd], **kwargs).stdout +def run(*cmd, **kwargs): + return run_pipe([cmd], **kwargs).stdout -def RunList(cmd): - return RunPipe([cmd], capture=True).stdout +def run_list(cmd): + return run_pipe([cmd], capture=True).stdout -def StopAll(): +def stop_all(): cros_subprocess.stay_alive = False |