Skip to content

Commit 707ae55

Browse files
committed
Fix possible issue with Arduino component for ESP-IDF // Resolve platformio#319
CMake fails to generate code model if this path contains @ symbol
1 parent 2d50d7b commit 707ae55

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

builder/frameworks/espidf.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import json
2525
import subprocess
2626
import sys
27-
from os import environ, listdir, makedirs, pathsep
27+
from os import environ, listdir, makedirs, rename, pathsep
2828
from os.path import (
2929
abspath,
3030
basename,
@@ -61,6 +61,14 @@
6161

6262
if "arduino" in env.subst("$PIOFRAMEWORK"):
6363
ARDUINO_FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
64+
# Possible package names in 'package@version' format is not compatible with CMake
65+
if "@" in basename(ARDUINO_FRAMEWORK_DIR):
66+
new_path = join(
67+
dirname(ARDUINO_FRAMEWORK_DIR),
68+
basename(ARDUINO_FRAMEWORK_DIR).replace("@", "-"),
69+
)
70+
rename(ARDUINO_FRAMEWORK_DIR, new_path)
71+
ARDUINO_FRAMEWORK_DIR = new_path
6472
assert ARDUINO_FRAMEWORK_DIR and isdir(ARDUINO_FRAMEWORK_DIR)
6573

6674
try:

0 commit comments

Comments
 (0)