Skip to content

Commit e366783

Browse files
committed
Fix usage of PICO_EXAMPLES_PATH
1 parent 1458333 commit e366783

File tree

3 files changed

+33
-32
lines changed

3 files changed

+33
-32
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ clean_submodules:
6262

6363
# Create the pico-sdk Doxygen XML files
6464
$(DOXYGEN_XML_DIR) $(DOXYGEN_XML_DIR)/index.xml: | $(ALL_SUBMODULE_CMAKELISTS) $(DOXYGEN_PICO_SDK_BUILD_DIR)
65-
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=combined-docs
66-
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2040
67-
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2350
65+
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined -D PICO_EXAMPLES_PATH=../../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=combined-docs
66+
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 -D PICO_EXAMPLES_PATH=../../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2040
67+
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 -D PICO_EXAMPLES_PATH=../../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2350
6868
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined docs
6969
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 docs
7070
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 docs

scripts/create_build_adoc_doxygen.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ def check_no_markdown(filename):
1616
asciidoc = re.sub(r'----\n.*?\n----', '', asciidoc, flags=re.DOTALL)
1717
# strip out pass-through blocks
1818
asciidoc = re.sub(r'\+\+\+\+\n.*?\n\+\+\+\+', '', asciidoc, flags=re.DOTALL)
19-
# This is messing up the c code blocks
20-
# if re.search(r'(?:^|\n)#+', asciidoc):
21-
# raise Exception("{} contains a Markdown-style header (i.e. '#' rather than '=')".format(filename))
19+
if re.search(r'(?:^|\n)#+', asciidoc):
20+
raise Exception("{} contains a Markdown-style header (i.e. '#' rather than '=')".format(filename))
2221
if re.search(r'(\[.+?\]\(.+?\))', asciidoc):
2322
raise Exception("{} contains a Markdown-style link (i.e. '[title](url)' rather than 'url[title]')".format(filename))
2423

scripts/postprocess_doxygen_xml.py

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import re
55
import os
6-
import html
6+
#import html
77
from bs4 import BeautifulSoup
88

99
# walk the combined output.
@@ -18,30 +18,31 @@ def compile_id_list(xml_content):
1818
id_list = [x["id"] for x in els]
1919
return id_list
2020

21-
def insert_example_code_from_file(combined_content):
22-
els = combined_content.doxygen.find_all("programlisting")
23-
all_examples = {}
24-
# get the examples path
25-
examples_path = re.sub(r"/scripts/.+$", "/lib/pico-examples", os.path.realpath(__file__))
26-
# get a recursive list of all files in examples
27-
for f in os.walk(examples_path):
28-
for filename in f[2]:
29-
if filename in all_examples:
30-
all_examples[filename].append(os.path.join(f[0], filename))
31-
else:
32-
all_examples[filename] = [os.path.join(f[0], filename)]
33-
for el in els:
34-
if el.get("filename") is not None:
35-
filename = el.get("filename")
36-
# find the file here or in examples
37-
if filename in all_examples:
38-
with open(all_examples[filename][0]) as f:
39-
example_content = f.read()
40-
example_lines = example_content.split("\n")
41-
for line in example_lines:
42-
codeline = BeautifulSoup("<codeline>"+html.escape(line)+"</codeline>", 'xml')
43-
el.append(codeline)
44-
return combined_content
21+
# Unused code - but kept in case we need it in future
22+
#def insert_example_code_from_file(combined_content):
23+
# els = combined_content.doxygen.find_all("programlisting")
24+
# all_examples = {}
25+
# # get the examples path
26+
# examples_path = re.sub(r"/scripts/.+$", "/lib/pico-examples", os.path.realpath(__file__))
27+
# # get a recursive list of all files in examples
28+
# for f in os.walk(examples_path):
29+
# for filename in f[2]:
30+
# if filename in all_examples:
31+
# all_examples[filename].append(os.path.join(f[0], filename))
32+
# else:
33+
# all_examples[filename] = [os.path.join(f[0], filename)]
34+
# for el in els:
35+
# if el.get("filename") is not None:
36+
# filename = el.get("filename")
37+
# # find the file here or in examples
38+
# if filename in all_examples:
39+
# with open(all_examples[filename][0]) as f:
40+
# example_content = f.read()
41+
# example_lines = example_content.split("\n")
42+
# for line in example_lines:
43+
# codeline = BeautifulSoup("<codeline>"+html.escape(line)+"</codeline>", 'xml')
44+
# el.append(codeline)
45+
# return combined_content
4546

4647
def walk_and_tag_xml_tree(el, output_contexts, all_contexts):
4748
"""
@@ -123,7 +124,8 @@ def postprocess_doxygen_xml_file(combined_xmlfile, xmlfiles, output_context_path
123124
els = combined_content.doxygen.find_all(True, recursive=False)
124125
for el in els:
125126
walk_and_tag_xml_tree(el, output_contexts, list(output_context_paths.keys()))
126-
combined_content = insert_example_code_from_file(combined_content)
127+
# I think this was only needed because the PICO_EXAMPLES_PATH was wrong in the Makefile
128+
#combined_content = insert_example_code_from_file(combined_content)
127129
return str(combined_content)
128130

129131
def postprocess_doxygen_xml(xml_path):

0 commit comments

Comments
 (0)