forked from platformio/platformio-core
Fix an issue when empty multiple values for project option were not casted to list // Resolve #2734
This commit is contained in:
@ -243,7 +243,7 @@ class ProjectConfig(object):
|
|||||||
if not option_meta:
|
if not option_meta:
|
||||||
return value or default
|
return value or default
|
||||||
|
|
||||||
if value and option_meta.multiple:
|
if option_meta.multiple:
|
||||||
value = self.parse_multi_values(value)
|
value = self.parse_multi_values(value)
|
||||||
|
|
||||||
if option_meta.sysenvvar:
|
if option_meta.sysenvvar:
|
||||||
|
@ -42,6 +42,7 @@ lib_ignore = LibIgnoreCustom
|
|||||||
|
|
||||||
[env:base]
|
[env:base]
|
||||||
build_flags = ${custom.debug_flags} ${custom.extra_flags}
|
build_flags = ${custom.debug_flags} ${custom.extra_flags}
|
||||||
|
targets =
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXTRA_ENVS_CONFIG = """
|
EXTRA_ENVS_CONFIG = """
|
||||||
@ -102,7 +103,7 @@ def test_real_config(tmpdir):
|
|||||||
|
|
||||||
# options
|
# options
|
||||||
assert config.options(env="base") == [
|
assert config.options(env="base") == [
|
||||||
"build_flags", "monitor_speed", "lib_deps", "lib_ignore"
|
"build_flags", "targets", "monitor_speed", "lib_deps", "lib_ignore"
|
||||||
]
|
]
|
||||||
|
|
||||||
# has_option
|
# has_option
|
||||||
@ -126,6 +127,7 @@ def test_real_config(tmpdir):
|
|||||||
assert config.get("env:extra_2", "upload_port") == "/dev/extra_2/port"
|
assert config.get("env:extra_2", "upload_port") == "/dev/extra_2/port"
|
||||||
|
|
||||||
# getraw
|
# getraw
|
||||||
|
assert config.getraw("env:base", "targets") == ""
|
||||||
assert config.getraw("env:extra_1", "lib_deps") == "574"
|
assert config.getraw("env:extra_1", "lib_deps") == "574"
|
||||||
assert config.getraw("env:extra_1", "build_flags") == "-lc -lm -D DEBUG=1"
|
assert config.getraw("env:extra_1", "build_flags") == "-lc -lm -D DEBUG=1"
|
||||||
|
|
||||||
@ -148,6 +150,16 @@ def test_real_config(tmpdir):
|
|||||||
("extra_flags", "-L /usr/local/lib"),
|
("extra_flags", "-L /usr/local/lib"),
|
||||||
("lib_ignore", "LibIgnoreCustom")
|
("lib_ignore", "LibIgnoreCustom")
|
||||||
] # yapf: disable
|
] # yapf: disable
|
||||||
|
print(config.items(env="base"))
|
||||||
|
assert config.items(env="base") == [
|
||||||
|
("build_flags", [
|
||||||
|
"-D DEBUG=1 -L /usr/local/lib", "-DSYSENVDEPS1 -DSYSENVDEPS2"]),
|
||||||
|
("targets", []),
|
||||||
|
("monitor_speed", "115200"),
|
||||||
|
("lib_deps", ["Lib1", "Lib2"]),
|
||||||
|
("lib_ignore", ["LibIgnoreCustom"]),
|
||||||
|
("upload_port", "/dev/sysenv/port")
|
||||||
|
] # yapf: disable
|
||||||
assert config.items(env="extra_1") == [
|
assert config.items(env="extra_1") == [
|
||||||
("build_flags", ["-lc -lm -D DEBUG=1", "-DSYSENVDEPS1 -DSYSENVDEPS2"]),
|
("build_flags", ["-lc -lm -D DEBUG=1", "-DSYSENVDEPS1 -DSYSENVDEPS2"]),
|
||||||
("lib_deps", ["574"]),
|
("lib_deps", ["574"]),
|
||||||
|
Reference in New Issue
Block a user