Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4453ca5

Browse filesBrowse files
authored
Properly handle ARDUINO_PARTITION define in PlatformIO (espressif#6681)
This fixes possible issues when developers specify arbitrary partition files using relative or absolute paths. Additionally, hyphens in filenames are replaced with underscores to avoid compilation warnings "ISO C++11 requires whitespace after the macro name" Resolves platformio/platform-espressif32#787
1 parent ce2cd11 commit 4453ca5
Copy full SHA for 4453ca5

File tree

Expand file treeCollapse file tree

4 files changed

+12
-8
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+12
-8
lines changed

‎tools/platformio-build-esp32.py

Copy file name to clipboardExpand all lines: tools/platformio-build-esp32.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# Extends: https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py
2626

27-
from os.path import abspath, isdir, isfile, join
27+
from os.path import abspath, basename, isdir, isfile, join
2828

2929
from SCons.Script import DefaultEnvironment
3030

@@ -319,7 +319,8 @@
319319
("ARDUINO", 10812),
320320
("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")),
321321
("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")),
322-
"ARDUINO_PARTITION_%s" % env.BoardConfig().get("build.partitions", "default.csv").replace(".csv", "")
322+
"ARDUINO_PARTITION_%s" % basename(env.BoardConfig().get(
323+
"build.partitions", "default.csv")).replace(".csv", "").replace("-", "_")
323324
],
324325

325326
LIBSOURCE_DIRS=[

‎tools/platformio-build-esp32c3.py

Copy file name to clipboardExpand all lines: tools/platformio-build-esp32c3.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# Extends: https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py
2626

27-
from os.path import abspath, isdir, isfile, join
27+
from os.path import abspath, basename, isdir, isfile, join
2828

2929
from SCons.Script import DefaultEnvironment
3030

@@ -312,7 +312,8 @@
312312
("ARDUINO", 10812),
313313
("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")),
314314
("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")),
315-
"ARDUINO_PARTITION_%s" % env.BoardConfig().get("build.partitions", "default.csv").replace(".csv", "")
315+
"ARDUINO_PARTITION_%s" % basename(env.BoardConfig().get(
316+
"build.partitions", "default.csv")).replace(".csv", "").replace("-", "_")
316317
],
317318

318319
LIBSOURCE_DIRS=[

‎tools/platformio-build-esp32s2.py

Copy file name to clipboardExpand all lines: tools/platformio-build-esp32s2.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# Extends: https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py
2626

27-
from os.path import abspath, isdir, isfile, join
27+
from os.path import abspath, basename, isdir, isfile, join
2828

2929
from SCons.Script import DefaultEnvironment
3030

@@ -314,7 +314,8 @@
314314
("ARDUINO", 10812),
315315
("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")),
316316
("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")),
317-
"ARDUINO_PARTITION_%s" % env.BoardConfig().get("build.partitions", "default.csv").replace(".csv", "")
317+
"ARDUINO_PARTITION_%s" % basename(env.BoardConfig().get(
318+
"build.partitions", "default.csv")).replace(".csv", "").replace("-", "_")
318319
],
319320

320321
LIBSOURCE_DIRS=[

‎tools/platformio-build-esp32s3.py

Copy file name to clipboardExpand all lines: tools/platformio-build-esp32s3.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# Extends: https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py
2626

27-
from os.path import abspath, isdir, isfile, join
27+
from os.path import abspath, basename, isdir, isfile, join
2828

2929
from SCons.Script import DefaultEnvironment
3030

@@ -331,7 +331,8 @@
331331
("ARDUINO", 10812),
332332
("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")),
333333
("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")),
334-
"ARDUINO_PARTITION_%s" % env.BoardConfig().get("build.partitions", "default.csv").replace(".csv", "")
334+
"ARDUINO_PARTITION_%s" % basename(env.BoardConfig().get(
335+
"build.partitions", "default.csv")).replace(".csv", "").replace("-", "_")
335336
],
336337

337338
LIBSOURCE_DIRS=[

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.