From 3f42be175348284768365e35b8f8a66cdbea5c3f Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Wed, 14 Oct 2020 19:31:29 +0800 Subject: [PATCH] tools: fix path handling errors in gen_esp_err_to_name.py for Windows Exclude paths that were specified with slash as a path separator were compared as strings. This would fail on Windows which uses backslash as a path separator. --- tools/gen_esp_err_to_name.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/gen_esp_err_to_name.py b/tools/gen_esp_err_to_name.py index 0e23ab3c0d..3cfa1e0c43 100755 --- a/tools/gen_esp_err_to_name.py +++ b/tools/gen_esp_err_to_name.py @@ -40,19 +40,20 @@ import textwrap import functools # list files here which should not be parsed -ignore_files = ['components/mdns/test_afl_fuzz_host/esp32_compat.h', # used only for host tests (redefines some err codes) - 'components/tcpip_adapter/include/tcpip_adapter_types.h' # tcpip_adapter in compatibility mode from 4.1 (errors reused in esp-netif) +ignore_files = [os.path.join('components', 'mdns', 'test_afl_fuzz_host', 'esp32_compat.h'), + # tcpip_adapter in compatibility mode from 4.1 (errors reused in esp-netif) + os.path.join('components', 'tcpip_adapter', 'include', 'tcpip_adapter_types.h') ] -# add directories here which should not be parsed -ignore_dirs = ('examples', 'components/cmock/CMock/test') +# add directories here which should not be parsed, this is a tuple since it will be used with *.startswith() +ignore_dirs = (os.path.join('examples'), os.path.join('components', 'cmock', 'CMock', 'test')) # macros from here have higher priorities in case of collisions -priority_headers = ['components/esp_common/include/esp_err.h'] +priority_headers = [os.path.join('components', 'esp_common', 'include', 'esp_err.h')] # The following headers won't be included. This is useful if they are permanently included from esp_err_to_name.c.in. -dont_include = ['soc/soc.h', - 'esp_err.h'] +dont_include = [os.path.join('soc', 'soc.h'), + os.path.join('esp_err.h')] err_dict = collections.defaultdict(list) # identified errors are stored here; mapped by the error code rev_err_dict = dict() # map of error string to error code