nvs_util: Add support to include comments in csv file

Closes https://github.com/espressif/esp-idf/issues/2965

(cherry picked from commit 66e38e9bac)
This commit is contained in:
Shivani Tipnis 2019-04-01 15:25:20 +05:30
parent 1cb29ac446
commit 1b8dd9f173
3 changed files with 3 additions and 1 deletions

View File

@ -752,7 +752,7 @@ def nvs_part_gen(input_filename=None, output_filename=None, input_part_size=None
output_file = open(output_filename, 'wb')
with nvs_open(output_file, input_size) as nvs_obj:
reader = csv.DictReader(input_file, delimiter=',')
reader = csv.DictReader(filter(lambda row: row[0] != '#',input_file), delimiter=',')
for row in reader:
try:
write_entry(nvs_obj, row["key"], row["type"], row["encoding"], row["value"])

View File

@ -1,3 +1,4 @@
# Sample csv file
key,type,encoding,value
dummyNamespace,namespace,,
dummyU8Key,data,u8,127

1 key # Sample csv file type encoding value
1 # Sample csv file
2 key key,type,encoding,value type encoding value
3 dummyNamespace dummyNamespace,namespace,, namespace
4 dummyU8Key dummyU8Key,data,u8,127 data u8 127

View File

@ -1,3 +1,4 @@
# Sample csv file
key,type,encoding,value
dummyNamespace,namespace,,
dummyU8Key,data,u8,127

1 key # Sample csv file type encoding value
1 # Sample csv file
2 key key,type,encoding,value type encoding value
3 dummyNamespace dummyNamespace,namespace,, namespace
4 dummyU8Key dummyU8Key,data,u8,127 data u8 127