mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/esp_err_name_idf_path' into 'master'
docs: fix error code reference build issue See merge request idf/esp-idf!2587
This commit is contained in:
commit
86d6c09387
@ -32,22 +32,28 @@ if 'BUILDDIR' in os.environ:
|
|||||||
|
|
||||||
# Call Doxygen to get XML files from the header files
|
# Call Doxygen to get XML files from the header files
|
||||||
print("Calling Doxygen to generate latest XML files")
|
print("Calling Doxygen to generate latest XML files")
|
||||||
os.system("doxygen ../Doxyfile")
|
if os.system("doxygen ../Doxyfile") != 0:
|
||||||
|
raise RuntimeError('Doxygen call failed')
|
||||||
|
|
||||||
# Doxygen has generated XML files in 'xml' directory.
|
# Doxygen has generated XML files in 'xml' directory.
|
||||||
# Copy them to 'xml_in', only touching the files which have changed.
|
# Copy them to 'xml_in', only touching the files which have changed.
|
||||||
copy_if_modified('xml/', 'xml_in/')
|
copy_if_modified('xml/', 'xml_in/')
|
||||||
|
|
||||||
# Generate 'api_name.inc' files using the XML files by Doxygen
|
# Generate 'api_name.inc' files using the XML files by Doxygen
|
||||||
os.system('python ../gen-dxd.py')
|
if os.system('python ../gen-dxd.py') != 0:
|
||||||
|
raise RuntimeError('gen-dxd.py failed')
|
||||||
|
|
||||||
# Generate 'kconfig.inc' file from components' Kconfig files
|
# Generate 'kconfig.inc' file from components' Kconfig files
|
||||||
kconfig_inc_path = '{}/inc/kconfig.inc'.format(builddir)
|
kconfig_inc_path = '{}/inc/kconfig.inc'.format(builddir)
|
||||||
os.system('python ../gen-kconfig-doc.py > ' + kconfig_inc_path + '.in')
|
if os.system('python ../gen-kconfig-doc.py > ' + kconfig_inc_path + '.in') != 0:
|
||||||
|
raise RuntimeError('gen-kconfig-doc.py failed')
|
||||||
|
|
||||||
copy_if_modified(kconfig_inc_path + '.in', kconfig_inc_path)
|
copy_if_modified(kconfig_inc_path + '.in', kconfig_inc_path)
|
||||||
|
|
||||||
# Generate 'esp_err_defs.inc' file with ESP_ERR_ error code definitions
|
# Generate 'esp_err_defs.inc' file with ESP_ERR_ error code definitions
|
||||||
esp_err_inc_path = '{}/inc/esp_err_defs.inc'.format(builddir)
|
esp_err_inc_path = '{}/inc/esp_err_defs.inc'.format(builddir)
|
||||||
os.system('python ../../tools/gen_esp_err_to_name.py --rst_output ' + esp_err_inc_path + '.in')
|
if os.system('python ../../tools/gen_esp_err_to_name.py --rst_output ' + esp_err_inc_path + '.in') != 0:
|
||||||
|
raise RuntimeError('gen_esp_err_to_name.py failed')
|
||||||
copy_if_modified(esp_err_inc_path + '.in', esp_err_inc_path)
|
copy_if_modified(esp_err_inc_path + '.in', esp_err_inc_path)
|
||||||
|
|
||||||
# http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format
|
# http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format
|
||||||
|
@ -277,24 +277,29 @@ def generate_rst_output(fout):
|
|||||||
fout.write('\n\n')
|
fout.write('\n\n')
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
if 'IDF_PATH' in os.environ:
|
||||||
|
idf_path = os.environ['IDF_PATH']
|
||||||
|
else:
|
||||||
|
idf_path = os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='ESP32 esp_err_to_name lookup generator for esp_err_t')
|
parser = argparse.ArgumentParser(description='ESP32 esp_err_to_name lookup generator for esp_err_t')
|
||||||
parser.add_argument('--c_input', help='Path to the esp_err_to_name.c.in template input.', default=os.environ['IDF_PATH'] + '/components/esp32/esp_err_to_name.c.in')
|
parser.add_argument('--c_input', help='Path to the esp_err_to_name.c.in template input.', default=idf_path + '/components/esp32/esp_err_to_name.c.in')
|
||||||
parser.add_argument('--c_output', help='Path to the esp_err_to_name.c output.', default=os.environ['IDF_PATH'] + '/components/esp32/esp_err_to_name.c')
|
parser.add_argument('--c_output', help='Path to the esp_err_to_name.c output.', default=idf_path + '/components/esp32/esp_err_to_name.c')
|
||||||
parser.add_argument('--rst_output', help='Generate .rst output and save it into this file')
|
parser.add_argument('--rst_output', help='Generate .rst output and save it into this file')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
for root, dirnames, filenames in os.walk(os.environ['IDF_PATH']):
|
for root, dirnames, filenames in os.walk(idf_path):
|
||||||
for filename in fnmatch.filter(filenames, '*.[ch]'):
|
for filename in fnmatch.filter(filenames, '*.[ch]'):
|
||||||
full_path = os.path.join(root, filename)
|
full_path = os.path.join(root, filename)
|
||||||
idf_path = os.path.relpath(full_path, os.environ['IDF_PATH'])
|
path_in_idf = os.path.relpath(full_path, idf_path)
|
||||||
if idf_path in ignore_files:
|
if path_in_idf in ignore_files:
|
||||||
continue
|
continue
|
||||||
with open(full_path, "r+") as f:
|
with open(full_path, "r+") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
# match also ESP_OK and ESP_FAIL because some of ESP_ERRs are referencing them
|
# match also ESP_OK and ESP_FAIL because some of ESP_ERRs are referencing them
|
||||||
if re.match(r"\s*#define\s+(ESP_ERR_|ESP_OK|ESP_FAIL)", line):
|
if re.match(r"\s*#define\s+(ESP_ERR_|ESP_OK|ESP_FAIL)", line):
|
||||||
try:
|
try:
|
||||||
process(str.strip(line), idf_path)
|
process(str.strip(line), path_in_idf)
|
||||||
except InputError as e:
|
except InputError as e:
|
||||||
print (e)
|
print (e)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user