From 1ea082a05397f25893977c7050b10601bf9e9390 Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov Date: Tue, 25 Jul 2017 18:12:31 +0200 Subject: [PATCH] Expand vars before splitting fields This allows making entire partition table line a variable. Merges https://github.com/espressif/esp-idf/pull/841 --- components/partition_table/gen_esp32part.py | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/components/partition_table/gen_esp32part.py b/components/partition_table/gen_esp32part.py index 2600ac214..897e637d0 100755 --- a/components/partition_table/gen_esp32part.py +++ b/components/partition_table/gen_esp32part.py @@ -51,9 +51,17 @@ class PartitionTable(list): @classmethod def from_csv(cls, csv_contents): res = PartitionTable() - lines = csv_contents.split("\n") + lines = csv_contents.splitlines() + + def expand_vars(f): + f = os.path.expandvars(f) + m = re.match(r'(?