forked from platformio/platformio-core
Parse only $PROJECT_HASH legacy built-in variable
This commit is contained in:
@ -316,10 +316,11 @@ class ProjectConfigBase:
|
||||
return value
|
||||
|
||||
# legacy support for variables delclared without "${}"
|
||||
legacy_vars = ["PROJECT_HASH"]
|
||||
stop = False
|
||||
while not stop:
|
||||
stop = True
|
||||
for name in self.BUILTIN_VARS:
|
||||
for name in legacy_vars:
|
||||
x = value.find(f"${name}")
|
||||
if x < 0 or value[x - 1] == "$":
|
||||
continue
|
||||
|
@ -354,10 +354,7 @@ def test_get_value(config):
|
||||
"--help",
|
||||
]
|
||||
# test relative dir
|
||||
assert config.get("platformio", "src_dir") == os.path.abspath(
|
||||
os.path.join(os.getcwd(), "source")
|
||||
)
|
||||
|
||||
assert config.get("platformio", "src_dir") == "source"
|
||||
# renamed option
|
||||
assert config.get("env:extra_1", "lib_install") == ["574"]
|
||||
assert config.get("env:extra_1", "lib_deps") == ["574"]
|
||||
@ -654,6 +651,7 @@ def test_nested_interpolation(tmp_path: Path):
|
||||
"""
|
||||
[platformio]
|
||||
build_dir = /tmp/pio-$PROJECT_HASH
|
||||
data_dir = $PROJECT_DIR/assets
|
||||
|
||||
[env:myenv]
|
||||
build_flags = -D UTIME=${UNIX_TIME}
|
||||
@ -667,9 +665,10 @@ test_testing_command =
|
||||
"""
|
||||
)
|
||||
config = ProjectConfig(str(project_conf))
|
||||
assert config.get("platformio", "data_dir") == "$PROJECT_DIR/assets"
|
||||
assert config.get("env:myenv", "build_flags")[0][-10:].isdigit()
|
||||
testing_command = config.get("env:myenv", "test_testing_command")
|
||||
assert "$" not in " ".join(testing_command)
|
||||
assert config.get("env:myenv", "build_flags")[0][-10:].isdigit()
|
||||
|
||||
|
||||
def test_extends_order(tmp_path: Path):
|
||||
|
Reference in New Issue
Block a user