mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
tools: Avoid subprocess.run(capture_output) argument for Python <3.7 compatibility
In Python 3.5 and 3.6 the equivalent to capture_output=True is to set stdout and stderr arguments to subprocess.PIPE
This commit is contained in:
@@ -202,9 +202,9 @@ def is_stable_version(version):
|
|||||||
if "-" in version:
|
if "-" in version:
|
||||||
return False # prerelease tag
|
return False # prerelease tag
|
||||||
|
|
||||||
git_out = subprocess.run(["git", "tag", "-l"], capture_output=True, check=True)
|
git_out = subprocess.check_output(["git", "tag", "-l"]).decode("utf-8")
|
||||||
|
|
||||||
versions = [v.strip() for v in git_out.stdout.decode("utf-8").split("\n")]
|
versions = [v.strip() for v in git_out.split("\n")]
|
||||||
versions = [v for v in versions if re.match(r"^v[\d\.]+$", v)] # include vX.Y.Z only
|
versions = [v for v in versions if re.match(r"^v[\d\.]+$", v)] # include vX.Y.Z only
|
||||||
|
|
||||||
versions = [packaging.version.parse(v) for v in versions]
|
versions = [packaging.version.parse(v) for v in versions]
|
||||||
|
@@ -181,7 +181,7 @@ def run_cmd_check_output(cmd, input_text=None, extra_paths=None):
|
|||||||
try:
|
try:
|
||||||
if input_text:
|
if input_text:
|
||||||
input_text = input_text.encode()
|
input_text = input_text.encode()
|
||||||
result = subprocess.run(cmd, capture_output=True, check=True, input=input_text)
|
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, input=input_text)
|
||||||
return result.stdout + result.stderr
|
return result.stdout + result.stderr
|
||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
Reference in New Issue
Block a user