python: Collapse away the now unused readCommandWithReturn function.

This had been used when detecting python versions, but can now be
absorbed into readCommand.

Change-Id: I4385357c3ce33a0f1b58e741067aa7ae3a7daa3b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41598
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
Gabe Black
2021-02-18 02:47:29 -08:00
parent 24175fb9bd
commit 016440c58e

View File

@@ -173,15 +173,15 @@ def printList(items, indent=4):
line += item
print(line)
def readCommandWithReturn(cmd, **kwargs):
def readCommand(cmd, **kwargs):
"""
run the command cmd, read the results and return them
this is sorta like `cmd` in shell
:param cmd: command to run with Popen
:type cmd: string, list
:returns: pair consisting on Popen retcode and the command stdout
:rtype: (int, string)
:returns: command stdout
:rtype: string
"""
from subprocess import Popen, PIPE, STDOUT
@@ -203,19 +203,7 @@ def readCommandWithReturn(cmd, **kwargs):
raise
output = subp.communicate()[0].decode('utf-8')
return subp.returncode, output
def readCommand(cmd, **kwargs):
"""
run the command cmd, read the results and return them
this is sorta like `cmd` in shell
:param cmd: command to run with Popen
:type cmd: string, list
:returns: command stdout
:rtype: string
"""
return readCommandWithReturn(cmd, **kwargs)[1]
return output
def makeDir(path):
"""Make a directory if it doesn't exist. If the path does exist,