fix merge error

This commit is contained in:
Jason2866
2025-07-23 17:45:04 +02:00
committed by GitHub
parent fe83285c44
commit df9b181bf0
+20 -88
View File
@@ -56,68 +56,6 @@ map_file = os.path.join(env.subst("$PROJECT_DIR"), env.subst("$PROGNAME") + ".ma
if os.path.exists(map_file):
os.remove(map_file)
def install_standard_python_deps():
def _get_installed_standard_pip_packages():
result = {}
packages = {}
pip_output = subprocess.check_output(
[
env.subst("$PYTHONEXE"),
"-m",
"pip",
"list",
"--format=json",
"--disable-pip-version-check",
]
)
try:
packages = json.loads(pip_output)
except:
print("Warning! Couldn't extract the list of installed Python packages.")
return {}
for p in packages:
result[p["name"]] = pepver_to_semver(p["version"])
return result
deps = {
"wheel": ">=0.35.1",
"rich-click": ">=1.8.6",
"PyYAML": ">=6.0.2",
"intelhex": ">=2.3.0",
"rich": ">=14.0.0",
"esp-idf-size": ">=1.6.1"
}
installed_packages = _get_installed_standard_pip_packages()
packages_to_install = []
for package, spec in deps.items():
if package not in installed_packages:
packages_to_install.append(package)
else:
version_spec = semantic_version.Spec(spec)
if not version_spec.match(installed_packages[package]):
packages_to_install.append(package)
if packages_to_install:
env.Execute(
env.VerboseAction(
(
'"$PYTHONEXE" -m pip install -U -q -q -q '
+ " ".join(
[
'"%s%s"' % (p, deps[p])
for p in packages_to_install
]
)
),
"Installing standard Python dependencies",
)
)
return
install_standard_python_deps()
# Allow changes in folders of managed components
os.environ["IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS"] = "1"
@@ -173,7 +111,7 @@ if "arduino" in env.subst("$PIOFRAMEWORK"):
os.rename(ARDUINO_FRAMEWORK_DIR, new_path)
ARDUINO_FRAMEWORK_DIR = new_path
assert ARDUINO_FRAMEWORK_DIR and os.path.isdir(ARDUINO_FRAMEWORK_DIR)
arduino_libs_mcu = join(platform.get_package_dir("framework-arduinoespressif32-libs"),mcu)
arduino_libs_mcu = join(platform.get_package_dir("framework-arduinoespressif32-libs"), mcu)
BUILD_DIR = env.subst("$BUILD_DIR")
PROJECT_DIR = env.subst("$PROJECT_DIR")
@@ -1548,24 +1486,17 @@ def generate_mbedtls_bundle(sdk_config):
def install_python_deps():
def _get_installed_pip_packages(python_exe_path):
def _get_installed_uv_packages(python_exe_path):
result = {}
packages = {}
pip_output = subprocess.check_output(
[
python_exe_path,
"-m",
"pip",
"list",
"--format=json",
"--disable-pip-version-check",
]
)
try:
packages = json.loads(pip_output)
except:
print("Warning! Couldn't extract the list of installed Python packages.")
uv_output = subprocess.check_output([
"uv", "pip", "list", "--python", python_exe_path, "--format=json"
])
packages = json.loads(uv_output)
except (subprocess.CalledProcessError, json.JSONDecodeError, OSError) as e:
print(f"Warning! Couldn't extract the list of installed Python packages: {e}")
return {}
for p in packages:
result[p["name"]] = pepver_to_semver(p["version"])
@@ -1576,13 +1507,13 @@ def install_python_deps():
return
deps = {
"wheel": ">=0.35.1",
"uv": ">=0.1.0",
# https://github.com/platformio/platformio-core/issues/4614
"urllib3": "<2",
# https://github.com/platformio/platform-espressif32/issues/635
"cryptography": "~=44.0.0",
"pyparsing": ">=3.1.0,<4",
"idf-component-manager": "~=2.0.1",
"idf-component-manager": "~=2.2",
"esp-idf-kconfig": "~=2.5.0"
}
@@ -1590,7 +1521,7 @@ def install_python_deps():
deps["chardet"] = ">=3.0.2,<4"
python_exe_path = get_python_exe()
installed_packages = _get_installed_pip_packages(python_exe_path)
installed_packages = _get_installed_uv_packages(python_exe_path)
packages_to_install = []
for package, spec in deps.items():
if package not in installed_packages:
@@ -1601,21 +1532,22 @@ def install_python_deps():
packages_to_install.append(package)
if packages_to_install:
packages_str = " ".join(['"%s%s"' % (p, deps[p]) for p in packages_to_install])
# Use uv to install packages in the specific Python environment
env.Execute(
env.VerboseAction(
(
'"%s" -m pip install -U -q -q -q ' % python_exe_path
+ " ".join(['"%s%s"' % (p, deps[p]) for p in packages_to_install])
),
"Installing ESP-IDF's Python dependencies",
f'uv pip install --python "{python_exe_path}" {packages_str}',
"Installing ESP-IDF's Python dependencies with uv",
)
)
if IS_WINDOWS and "windows-curses" not in installed_packages:
# Install windows-curses in the IDF Python environment
env.Execute(
env.VerboseAction(
'"%s" -m pip install -q -q -q windows-curses' % python_exe_path,
"Installing windows-curses package",
f'uv pip install --python "{python_exe_path}" windows-curses',
"Installing windows-curses package with uv",
)
)