From 22c38771837ce8be8208d40fafbdc1d35c055a56 Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov Date: Thu, 26 Jan 2017 01:47:53 +0000 Subject: [PATCH 1/2] Expand environment variables in gen_esp32part Allows parametrizing partition table with (exported) make variables. --- components/partition_table/gen_esp32part.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/partition_table/gen_esp32part.py b/components/partition_table/gen_esp32part.py index 0491204885..6d6137f172 100755 --- a/components/partition_table/gen_esp32part.py +++ b/components/partition_table/gen_esp32part.py @@ -5,8 +5,10 @@ # Converts partition tables to/from CSV and binary formats. # # See the sdkng README.md file for details about how to use this tool. -import struct import argparse +import os +import re +import struct import sys MAX_PARTITION_LENGTH = 0xC00 # 3K for partition data (96 entries) leaves 1K in a 4K sector for signature @@ -163,7 +165,13 @@ class PartitionDefinition(object): def from_csv(cls, line): """ Parse a line from the CSV """ line_w_defaults = line + ",,,," # lazy way to support default fields - fields = [ f.strip() for f in line_w_defaults.split(",") ] + def expand_vars(f): + f = os.path.expandvars(f) + m = re.match(r'(?>sys.stderr, e sys.exit(2) From 24cfe78962887b85f49c56eea8d7a9f127805900 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 15 Feb 2017 10:28:45 +1100 Subject: [PATCH 2/2] partition table: Fix comment at top of gen_esp32part.py --- components/partition_table/gen_esp32part.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/partition_table/gen_esp32part.py b/components/partition_table/gen_esp32part.py index 6d6137f172..e4c999ab0f 100755 --- a/components/partition_table/gen_esp32part.py +++ b/components/partition_table/gen_esp32part.py @@ -4,7 +4,8 @@ # # Converts partition tables to/from CSV and binary formats. # -# See the sdkng README.md file for details about how to use this tool. +# See http://esp-idf.readthedocs.io/en/latest/partition-tables.html for explanation of +# partition table structure and uses. import argparse import os import re