Merge branch 'bugfix/esp_err_to_name_windows' into 'master'
gen_esp_err_to_name.py: Use normal file I/O instead of mmap() See merge request idf/esp-idf!2425
This commit is contained in:
commit
035dc66cce
1 changed files with 8 additions and 14 deletions
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
import mmap
|
|
||||||
import re
|
import re
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import string
|
import string
|
||||||
|
@ -277,19 +276,14 @@ def main():
|
||||||
idf_path = os.path.relpath(full_path, os.environ['IDF_PATH'])
|
idf_path = os.path.relpath(full_path, os.environ['IDF_PATH'])
|
||||||
if idf_path in ignore_files:
|
if idf_path in ignore_files:
|
||||||
continue
|
continue
|
||||||
with open(full_path, "r+b") as f:
|
with open(full_path, "r+") as f:
|
||||||
try:
|
for line in f:
|
||||||
map = mmap.mmap(f.fileno(), 0, prot=mmap.ACCESS_READ)
|
# match also ESP_OK and ESP_FAIL because some of ESP_ERRs are referencing them
|
||||||
except ValueError:
|
if re.match(r"\s*#define\s+(ESP_ERR_|ESP_OK|ESP_FAIL)", line):
|
||||||
pass # An empty file cannot be mmaped
|
try:
|
||||||
else:
|
process(str.strip(line), idf_path)
|
||||||
for line in iter(map.readline, ""):
|
except InputError as e:
|
||||||
# match also ESP_OK and ESP_FAIL because some of ESP_ERRs are referencing them
|
print (e)
|
||||||
if re.match(r"\s*#define\s+(ESP_ERR_|ESP_OK|ESP_FAIL)", line):
|
|
||||||
try:
|
|
||||||
process(str.strip(line), idf_path)
|
|
||||||
except InputError as e:
|
|
||||||
print (e)
|
|
||||||
|
|
||||||
process_remaining_errors()
|
process_remaining_errors()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue