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