From 707ae550743dc76198bd27d61ebacfcd37f5e60e Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Thu, 16 Apr 2020 21:43:27 +0300 Subject: [PATCH] Fix possible issue with Arduino component for ESP-IDF // Resolve #319 CMake fails to generate code model if this path contains @ symbol --- builder/frameworks/espidf.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 331757f..07cfe97 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -24,7 +24,7 @@ import copy import json import subprocess import sys -from os import environ, listdir, makedirs, pathsep +from os import environ, listdir, makedirs, rename, pathsep from os.path import ( abspath, basename, @@ -61,6 +61,14 @@ assert FRAMEWORK_DIR and isdir(FRAMEWORK_DIR) if "arduino" in env.subst("$PIOFRAMEWORK"): ARDUINO_FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") + # Possible package names in 'package@version' format is not compatible with CMake + if "@" in basename(ARDUINO_FRAMEWORK_DIR): + new_path = join( + dirname(ARDUINO_FRAMEWORK_DIR), + basename(ARDUINO_FRAMEWORK_DIR).replace("@", "-"), + ) + rename(ARDUINO_FRAMEWORK_DIR, new_path) + ARDUINO_FRAMEWORK_DIR = new_path assert ARDUINO_FRAMEWORK_DIR and isdir(ARDUINO_FRAMEWORK_DIR) try: