|
28 | 28 | import os |
29 | 29 | import sys |
30 | 30 | import shutil |
31 | | -from os.path import join |
| 31 | +from os.path import join, exists |
32 | 32 |
|
33 | 33 | from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, SConscript |
34 | 34 | from platformio import fs |
@@ -233,12 +233,18 @@ def shorthen_includes(env, node): |
233 | 233 | def call_compile_libs(): |
234 | 234 | if mcu == "esp32c2": |
235 | 235 | ARDUINO_FRMWRK_C2_LIB_DIR = join(platform.get_package_dir("framework-arduinoespressif32-libs"),mcu) |
236 | | - ARDUINO_C2_DIR = join(platform.get_package_dir("framework-arduino-c2-skeleton-lib"),mcu) |
237 | | - shutil.copytree(ARDUINO_C2_DIR, ARDUINO_FRMWRK_C2_LIB_DIR, dirs_exist_ok=True) |
| 236 | + if not os.path.exists(ARDUINO_FRMWRK_C2_LIB_DIR): |
| 237 | + ARDUINO_C2_DIR = join(platform.get_package_dir("framework-arduino-c2-skeleton-lib"),mcu) |
| 238 | + shutil.copytree(ARDUINO_C2_DIR, ARDUINO_FRMWRK_C2_LIB_DIR, dirs_exist_ok=True) |
238 | 239 | print("*** Compile Arduino IDF libs for %s ***" % env["PIOENV"]) |
239 | 240 | SConscript("espidf.py") |
240 | 241 |
|
241 | 242 | if check_reinstall_frwrk() == True: |
| 243 | + envs = [section.replace("env:", "") for section in config.sections() if section.startswith("env:")] |
| 244 | + for env_name in envs: |
| 245 | + file_path = join(env.subst("$PROJECT_DIR"), f"sdkconfig.{env_name}") |
| 246 | + if exists(file_path): |
| 247 | + os.remove(file_path) |
242 | 248 | print("*** Reinstall Arduino framework ***") |
243 | 249 | shutil.rmtree(platform.get_package_dir("framework-arduinoespressif32")) |
244 | 250 | shutil.rmtree(platform.get_package_dir("framework-arduinoespressif32-libs")) |
|
0 commit comments