Skip to content

Commit d43c112

Browse files
committed
Modifications for changed build on readthedocs
1 parent c5c3911 commit d43c112

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

.readthedocs.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
apt_packages:
12+
- doxygen
13+
- graphviz
14+
tools:
15+
python: "3.11"
16+
17+
# Build documentation in the docs/ directory with Sphinx
18+
sphinx:
19+
configuration: sphinxdoc/source/conf.py
20+
21+
# We recommend specifying your dependencies to enable reproducible builds:
22+
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
23+
# python:
24+
# install:
25+
# - requirements: docs/requirements.txt

sphinxdoc/source/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,14 @@ def changeVersionString():
353353

354354
try:
355355
if os.getenv("READTHEDOCS") == 'True':
356-
dstdir = "_build/html"
356+
dstdir = os.path.join(os.environ["READTHEDOCS_OUTPUT"], "html")
357357
else:
358358
dstdir = "../build/html"
359359

360360
dstdir = os.path.abspath(dstdir)
361+
if not os.path.exists(dstdir):
362+
print("Destination directory did not exist, creating it")
363+
os.makedirs(dstdir, exist_ok=True)
361364

362365
os.chdir("../../")
363366
if os.path.exists("Doxyfile"):
@@ -391,11 +394,12 @@ def changeVersionString():
391394
finally:
392395
os.chdir(curpath)
393396

394-
with open("test.rst", "wb") as f:
397+
with open("test.rst", "wt") as f:
395398
f.write("Test output\n")
396399
f.write("===========\n\n")
397400
f.write(".. code-block:: none\n\n")
398401
output = subprocess.check_output("which doxygen ; pwd ; set ; ls ; ls _build ; ls _build/html ; ls ../ ; ", shell = True)
402+
output = output.decode()
399403
for l in output.splitlines():
400404
f.write(" ")
401405
f.write(l)

0 commit comments

Comments
 (0)