[core] Fix ltchiptool installation in PlatformIO

This commit is contained in:
Kuba Szczodrzyński
2023-05-23 12:12:42 +02:00
parent 27a7faaab7
commit 5c4da6e82b

View File

@@ -5,8 +5,8 @@ import json
import os
import platform
import sys
from os import system
from os.path import dirname
from subprocess import Popen
from typing import Dict, List
import click
@@ -25,10 +25,18 @@ def check_ltchiptool(install: bool):
if install:
# update ltchiptool to a supported version
print("Installing/updating ltchiptool")
system(
f'"{sys.executable}" -m pip install -U --force-reinstall '
f'"ltchiptool >= {LTCHIPTOOL_VERSION[1:]}, < 5.0"'
p = Popen(
[
sys.executable,
"-m",
"pip",
"install",
"-U",
"--force-reinstall",
f"ltchiptool >= {LTCHIPTOOL_VERSION[1:]}, < 5.0",
],
)
p.wait()
# unload all modules from the old version
for name, module in list(sorted(sys.modules.items())):