25
25
import subprocess
26
26
import sys
27
27
import os
28
+ import pkg_resources
28
29
29
30
import click
30
31
import semantic_version
49
50
mcu = board .get ("build.mcu" , "esp32" )
50
51
idf_variant = mcu .lower ()
51
52
53
+ # Required until Arduino switches to v5
54
+ IDF5 = platform .get_package_version (
55
+ "framework-espidf" ).split ("." )[1 ].startswith ("5" )
52
56
FRAMEWORK_DIR = platform .get_package_dir ("framework-espidf" )
53
57
TOOLCHAIN_DIR = platform .get_package_dir (
54
58
"toolchain-%s" % ("riscv32-esp" if mcu == "esp32c3" else ("xtensa-%s" % mcu ))
@@ -585,6 +589,7 @@ def _fix_component_relative_include(config, build_flags, source_index):
585
589
build_flags = build_flags .replace (".." , os .path .dirname (source_file_path ) + "/.." )
586
590
return build_flags
587
591
592
+
588
593
def prepare_build_envs (config , default_env , debug_allowed = True ):
589
594
build_envs = []
590
595
target_compile_groups = config .get ("compileGroups" )
@@ -1073,15 +1078,15 @@ def _get_installed_pip_packages():
1073
1078
# https://github.com/platformio/platform-espressif32/issues/635
1074
1079
"cryptography" : ">=2.1.4,<35.0.0" ,
1075
1080
"future" : ">=0.15.2" ,
1076
- "pyparsing" : ">=3"
1077
- if platform .get_package_version ("framework-espidf" )
1078
- .split ("." )[1 ]
1079
- .startswith ("5" )
1080
- else ">=2.0.3,<2.4.0" ,
1081
+ "pyparsing" : ">=2.0.3,<2.4.0" ,
1081
1082
"kconfiglib" : "==13.7.1" ,
1082
1083
"idf-component-manager" : "~=1.0" ,
1083
1084
}
1084
1085
1086
+ if IDF5 :
1087
+ # Remove specific versions for IDF5 as not required
1088
+ deps = {dep : "" for dep in deps }
1089
+
1085
1090
installed_packages = _get_installed_pip_packages ()
1086
1091
packages_to_install = []
1087
1092
for package , spec in deps .items ():
@@ -1096,21 +1101,34 @@ def _get_installed_pip_packages():
1096
1101
env .Execute (
1097
1102
env .VerboseAction (
1098
1103
(
1099
- '"$PYTHONEXE" -m pip install -U --force-reinstall '
1100
- + " " .join (['"%s%s"' % (p , deps [p ]) for p in packages_to_install ])
1104
+ '"$PYTHONEXE" -m pip install -U '
1105
+ + " " .join (
1106
+ [
1107
+ '"%s%s"' % (p , deps [p ])
1108
+ for p in packages_to_install
1109
+ ]
1110
+ )
1101
1111
),
1102
1112
"Installing ESP-IDF's Python dependencies" ,
1103
1113
)
1104
1114
)
1105
1115
1106
- # a special "esp-windows-curses" python package is required on Windows for Menuconfig
1107
- if "windows" in get_systype ():
1108
- import pkg_resources
1116
+ if "windows" in get_systype () and "windows-curses" not in installed_packages :
1117
+ env .Execute (
1118
+ env .VerboseAction (
1119
+ "$PYTHONEXE -m pip install windows-curses" ,
1120
+ "Installing windows-curses package" ,
1121
+ )
1122
+ )
1109
1123
1110
- if "esp-windows-curses" not in {pkg .key for pkg in pkg_resources .working_set }:
1124
+ # A special "esp-windows-curses" python package is required on Windows
1125
+ # for Menuconfig on IDF <5
1126
+ if not IDF5 and "esp-windows-curses" not in {
1127
+ pkg .key for pkg in pkg_resources .working_set
1128
+ }:
1111
1129
env .Execute (
1112
1130
env .VerboseAction (
1113
- '$PYTHONEXE -m pip install "file://%s/tools/kconfig_new/esp-windows-curses" windows-curses '
1131
+ '$PYTHONEXE -m pip install "file://%s/tools/kconfig_new/esp-windows-curses"'
1114
1132
% FRAMEWORK_DIR ,
1115
1133
"Installing windows-curses package" ,
1116
1134
)
0 commit comments