forked from platformio/platformio-core
Improve support for Python 3.6
This commit is contained in:
@ -53,16 +53,15 @@ def cli(dev, verbose):
|
|||||||
subprocess.run(
|
subprocess.run(
|
||||||
[python_exe, "-m", "pip", "install", "--upgrade", pkg_spec],
|
[python_exe, "-m", "pip", "install", "--upgrade", pkg_spec],
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=not verbose,
|
stdout=subprocess.PIPE if not verbose else None,
|
||||||
)
|
)
|
||||||
r = subprocess.run(
|
output = subprocess.run(
|
||||||
[python_exe, "-m", "platformio", "--version"],
|
[python_exe, "-m", "platformio", "--version"],
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
stdout=subprocess.PIPE,
|
||||||
text=True,
|
).stdout.decode()
|
||||||
)
|
assert "version" in output
|
||||||
assert "version" in r.stdout
|
actual_version = output.split("version", 1)[1].strip()
|
||||||
actual_version = r.stdout.split("version", 1)[1].strip()
|
|
||||||
click.secho(
|
click.secho(
|
||||||
"PlatformIO has been successfully upgraded to %s" % actual_version,
|
"PlatformIO has been successfully upgraded to %s" % actual_version,
|
||||||
fg="green",
|
fg="green",
|
||||||
|
@ -29,8 +29,10 @@ class ShellType(Enum):
|
|||||||
|
|
||||||
|
|
||||||
def get_bash_version():
|
def get_bash_version():
|
||||||
result = subprocess.run(["bash", "--version"], capture_output=True, check=True)
|
output = subprocess.run(
|
||||||
match = re.search(r"version\s+(\d+)\.(\d+)", result.stdout.decode(), re.IGNORECASE)
|
["bash", "--version"], check=True, stdout=subprocess.PIPE
|
||||||
|
).stdout.decode()
|
||||||
|
match = re.search(r"version\s+(\d+)\.(\d+)", output, re.IGNORECASE)
|
||||||
if match:
|
if match:
|
||||||
return (int(match.group(1)), int(match.group(2)))
|
return (int(match.group(1)), int(match.group(2)))
|
||||||
return (0, 0)
|
return (0, 0)
|
||||||
|
Reference in New Issue
Block a user