Skip to content

Commit 7f55cab

Browse files
author
Javier Gil Aviles
committed
Refs #22788: Apply second review changes
Signed-off-by: Javier Gil Aviles <javiergil@eprosima.com>
1 parent 2583190 commit 7f55cab

8 files changed

Lines changed: 76 additions & 216 deletions

File tree

.github/workflows/reusable-ubuntu-ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,3 @@ jobs:
199199

200200
- name: Python Linter
201201
uses: eProsima/eProsima-CI/ubuntu/python_linter@v0
202-
with:
203-
file_extensions_grep_args: "-e '^(?!ddsenabler_docs/).+\\.py$'"

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ log/
5656
.vscode
5757

5858
### Documentation ###
59-
ddsenabler_docs/docs/rst/_static/css/online_eprosima_rtd_theme.css
6059
ddsenabler_docs/docs/_static/css/eprosima-furo.css
6160
ddsenabler_docs/docs/_static/eprosima-logo-white.png
62-
ddsenabler_docs/docs/_static/dds-enabler-logo.png
6361
ddsenabler_docs/docs/_templates/sidebar/commercial-support.html
6462

6563
### Python ###

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ Leverage [OMG DDS-XTypes 1.3](https://www.omg.org/spec/DDS-XTypes/1.3) and Fast
4848
- **Bidirectional FIWARE Integration**
4949
Routes DDS samples to NGSI-LD Context Brokers and injects context updates back into DDS topics.
5050

51-
![DDS Enabler Architecture](docs/rst/figures/ddsenabler_architecture.png)
52-
5351
## Commercial support
5452

5553
Looking for commercial support? Write us to info@eprosima.com

ddsenabler/CMakeLists.txt

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -95,54 +95,3 @@ endif()
9595
# Install package
9696
eprosima_packaging()
9797

98-
###############################################################################
99-
# Documentation
100-
###############################################################################
101-
# Add an option to toggle the generation of the API documentation.
102-
option(DDSENABLER_DOCS "Use doxygen to create product documentation" OFF)
103-
104-
if(DDSENABLER_DOCS)
105-
find_package(Doxygen)
106-
if(NOT DOXYGEN_FOUND)
107-
message(FATAL_ERROR "doxygen is needed to build the documentation. Please install it correctly")
108-
endif()
109-
if(UNIX)
110-
find_program(DOXYFILE_MAKE make)
111-
if(DOXYFILE_MAKE)
112-
message(STATUS "Found Make: ${DOXYFILE_MAKE}")
113-
else()
114-
message(FATAL_ERROR "make is needed to build the documentation. Please install it correctly")
115-
endif()
116-
elseif(WIN32)
117-
set(DOXYFILE_MAKE make.bat)
118-
endif()
119-
120-
# Target to create documentation directories
121-
add_custom_target(docsdirs
122-
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/docs
123-
COMMENT "Creating documentation directory" VERBATIM)
124-
125-
### Doxygen ########################3
126-
# Configure the template doxyfile for or specific project
127-
configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.in
128-
${PROJECT_BINARY_DIR}/Doxyfile
129-
@ONLY IMMEDIATE)
130-
# Add custom target to run doxygen whenever the project is build
131-
add_custom_target(doxygen
132-
COMMAND "${DOXYGEN_EXECUTABLE}" "${PROJECT_BINARY_DIR}/Doxyfile"
133-
SOURCES "${PROJECT_BINARY_DIR}/Doxyfile"
134-
COMMENT "Generating API documentation with doxygen" VERBATIM)
135-
136-
add_dependencies(doxygen docsdirs)
137-
138-
add_custom_target(docs ALL
139-
COMMENT "Generated project documentation" VERBATIM)
140-
141-
add_dependencies(docs doxygen)
142-
143-
install(DIRECTORY ${PROJECT_BINARY_DIR}/docs/api_reference
144-
DESTINATION share/docs
145-
COMPONENT documentation
146-
)
147-
endif()
148-

ddsenabler_docs/docs/_static/css/online_eprosima_rtd_theme.css

Lines changed: 0 additions & 86 deletions
This file was deleted.
-21.5 KB
Binary file not shown.

ddsenabler_docs/docs/conf.py

Lines changed: 75 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,34 @@ def download_json():
126126
return ret
127127

128128

129+
def _download_and_write(url, dest, err_prefix):
130+
"""
131+
Download a file from the given URL and write its content to the specified destination.
132+
133+
:param url: The URL to fetch.
134+
:param dest: The local filesystem path where the content will be saved.
135+
:param err_prefix: A prefix for error messages in case of failure.
136+
137+
:return: True if the download and write succeed, False otherwise.
138+
"""
139+
try:
140+
resp = requests.get(url, allow_redirects=True, timeout=10)
141+
except requests.RequestException as e:
142+
print(f'{err_prefix} Request Error: {e}')
143+
return False
144+
if resp.status_code != 200:
145+
print(f'{err_prefix} Return code: {resp.status_code}')
146+
return False
147+
os.makedirs(os.path.dirname(dest), exist_ok=True)
148+
try:
149+
with open(dest, 'wb') as f:
150+
f.write(resp.content)
151+
except OSError:
152+
print(f'Failed to create file: {dest}')
153+
return False
154+
return True
155+
156+
129157
def retrieve_custom_sidebar(root_dir):
130158
"""
131159
Generate the custom sidebar, downloading necessary custom files.
@@ -136,82 +164,57 @@ def retrieve_custom_sidebar(root_dir):
136164
:return: Custom sidebars if the file was downloaded and generated successfully.
137165
Readthedocs default ones if not.
138166
"""
139-
url = "https://raw.githubusercontent.com/eProsima/all-docs/master/source/_templates/sidebar/commercial-support.html"
140-
url_img = "https://raw.githubusercontent.com/eProsima/all-docs/master/source/_static/eprosima-logo-white.png"
141-
ret = {
142-
"**": [
143-
"sidebar/brand.html",
144-
"sidebar/search.html",
145-
"sidebar/scroll-start.html",
146-
"sidebar/navigation.html",
147-
"sidebar/ethical-ads.html",
148-
"sidebar/scroll-end.html",
149-
"sidebar/variant-selector.html",
167+
html_url = (
168+
'https://raw.githubusercontent.com/eProsima/all-docs/'
169+
'master/source/_templates/sidebar/commercial-support.html'
170+
)
171+
img_url = (
172+
'https://raw.githubusercontent.com/eProsima/all-docs/'
173+
'master/source/_static/eprosima-logo-white.png'
174+
)
175+
default = {
176+
'**': [
177+
'sidebar/brand.html',
178+
'sidebar/search.html',
179+
'sidebar/scroll-start.html',
180+
'sidebar/navigation.html',
181+
'sidebar/ethical-ads.html',
182+
'sidebar/scroll-end.html',
183+
'sidebar/variant-selector.html',
150184
]
151185
}
152-
if not os.path.isfile(
153-
"{}/_templates/sidebar/commercial-support.html".format(root_dir)
154-
):
155-
try:
156-
req = requests.get(url, allow_redirects=True, timeout=10)
157-
except requests.RequestException as e:
158-
print(
159-
"Failed to download the HTML with the eProsima commecial support button."
160-
"Request Error: {}".format(e)
161-
)
162-
return ret
163-
if req.status_code != 200:
164-
print(
165-
"Failed to download the HTML with the eProsima commercial support button."
166-
"Return code: {}".format(req.status_code)
167-
)
168-
return ret
169-
os.makedirs(
170-
os.path.dirname("{}/_templates/sidebar/".format(root_dir)), exist_ok=True
171-
)
172-
html_path = "{}/_templates/sidebar/commercial-support.html".format(root_dir)
173-
with open(html_path, "wb") as f:
174-
try:
175-
f.write(req.content)
176-
except OSError:
177-
print("Failed to create the file: {}".format(html_path))
178-
return ret
179-
180-
if not os.path.isfile("{}/_static/eprosima-logo-white.png".format(root_dir)):
181-
try:
182-
req = requests.get(url_img, allow_redirects=True, timeout=10)
183-
except requests.RequestException as e:
184-
print(
185-
"Failed to download the image for the eProsima commecial support button."
186-
"Request Error: {}".format(e)
187-
)
188-
return ret
189-
if req.status_code != 200:
190-
print(
191-
"Failed to download the image for the eProsima commercial support button."
192-
"Return code: {}".format(req.status_code)
193-
)
194-
return ret
195-
img_path = "{}/_static/eprosima-logo-white.png".format(root_dir)
196-
with open(img_path, "wb") as f:
197-
try:
198-
f.write(req.content)
199-
except OSError:
200-
print("Failed to create the file: {}".format(img_path))
201-
return ret
202-
ret = {
203-
"**": [
204-
"sidebar/brand.html",
205-
"sidebar/commercial-support.html",
206-
"sidebar/search.html",
207-
"sidebar/scroll-start.html",
208-
"sidebar/navigation.html",
209-
"sidebar/ethical-ads.html",
210-
"sidebar/scroll-end.html",
211-
"sidebar/variant-selector.html",
186+
html_path = f'{root_dir}/_templates/sidebar/commercial-support.html'
187+
if not os.path.isfile(html_path):
188+
if not _download_and_write(
189+
html_url,
190+
html_path,
191+
'Failed to download the HTML with the eProsima commercial '
192+
'support button.'
193+
):
194+
return default
195+
196+
img_path = f'{root_dir}/_static/eprosima-logo-white.png'
197+
if not os.path.isfile(img_path):
198+
if not _download_and_write(
199+
img_url,
200+
img_path,
201+
'Failed to download the image for the eProsima commercial '
202+
'support button.'
203+
):
204+
return default
205+
206+
return {
207+
'**': [
208+
'sidebar/brand.html',
209+
'sidebar/commercial-support.html',
210+
'sidebar/search.html',
211+
'sidebar/scroll-start.html',
212+
'sidebar/navigation.html',
213+
'sidebar/ethical-ads.html',
214+
'sidebar/scroll-end.html',
215+
'sidebar/variant-selector.html',
212216
]
213217
}
214-
return ret
215218

216219

217220
def download_css(html_css_dir):

ddsenabler_docs/docs/notes/notes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. include:: ../3-exports/alias.include
1+
.. include:: ../03-exports/alias.include
22

33
.. _release_notes:
44

0 commit comments

Comments
 (0)