Skip to content

Commit

Permalink
fix: remove unecessary _tket perfix in local docs build (#1721)
Browse files Browse the repository at this point in the history
* update build script to replace _tket

* delete unused makefile

* uncomment sed

* fix path for searchindex.js sed

* final fix for search index replace

* make shell script work for linux and mac

* uupdate script to align with website build

* minor edits

* fix comment
  • Loading branch information
CalMacCQ authored Dec 13, 2024
1 parent 22aab40 commit 5f7af8d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
27 changes: 0 additions & 27 deletions pytket/docs/Makefile

This file was deleted.

18 changes: 17 additions & 1 deletion pytket/docs/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@ cp -R pytket-docs-theming/_static .
cp -R pytket-docs-theming/quantinuum-sphinx .
cp pytket-docs-theming/conf.py .

sphinx-build -b html . build -D html_title="pytket"
# Get pytket package version to be used in page title
PYTKET_VERSION="$(pip show pytket| grep Version | awk '{print $2}')"

PACKAGE="pytket $PYTKET_VERSION"

# Build the docs setting the html title to show the correct pytket version.
sphinx-build -b html . build -D html_title="$PACKAGE API documentation"

# Replace unnecessary _tket for all classes and functions in the built html
# Apple MACOSX and Linux have differing sed replace syntax
if [[ "$OSTYPE" == "darwin"* ]]; then
find build/ -type f -name "*.html" | xargs sed -e 's/pytket._tket/pytket/g' -i ""
sed -i '' 's/pytket._tket/pytket/g' build/searchindex.js
else
find build/ -type f -name "*.html" | xargs sed -i 's/pytket._tket/pytket/g'
sed -i 's/pytket._tket/pytket/g' build/searchindex.js
fi

# Remove copied files. This ensures reusability.
rm -r _static
Expand Down

0 comments on commit 5f7af8d

Please sign in to comment.