mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
feat(tools): Enforce utf-8 encoding with open() function
This commit is contained in:
@@ -126,13 +126,13 @@ class FuseTable(list):
|
||||
field_name = p.field_name + p.group
|
||||
if field_name != '' and len(duplicates.intersection([field_name])) != 0:
|
||||
fl_error = True
|
||||
print('Field at %s, %s, %s, %s have dublicate field_name' %
|
||||
print('Field at %s, %s, %s, %s have duplicate field_name' %
|
||||
(p.field_name, p.efuse_block, p.bit_start, p.bit_count))
|
||||
if fl_error is True:
|
||||
raise InputError('Field names must be unique')
|
||||
|
||||
def check_struct_field_name(self):
|
||||
# check that stuctured fields have a root field
|
||||
# check that structured fields have a root field
|
||||
for p in self:
|
||||
if '.' in p.field_name:
|
||||
name = ''
|
||||
@@ -454,7 +454,7 @@ def process_input_file(file, type_table):
|
||||
|
||||
def ckeck_md5_in_file(md5, filename):
|
||||
if os.path.exists(filename):
|
||||
with open(filename, 'r') as f:
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
if md5 in line:
|
||||
return True
|
||||
@@ -478,12 +478,12 @@ def create_output_files(name, output_table, debug):
|
||||
if ckeck_md5_in_file(output_table.md5_digest_table, file_c_path) is False:
|
||||
status('Creating efuse *.h file ' + file_h_path + ' ...')
|
||||
output = output_table.to_header(file_name)
|
||||
with open(file_h_path, 'w') as f:
|
||||
with open(file_h_path, 'w', encoding='utf-8') as f:
|
||||
f.write(output)
|
||||
|
||||
status('Creating efuse *.c file ' + file_c_path + ' ...')
|
||||
output = output_table.to_c_file(file_name, debug)
|
||||
with open(file_c_path, 'w') as f:
|
||||
with open(file_c_path, 'w', encoding='utf-8') as f:
|
||||
f.write(output)
|
||||
else:
|
||||
print('Source files do not require updating correspond to csv file.')
|
||||
|
Reference in New Issue
Block a user