-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build docs separate #122
Build docs separate #122
Changes from all commits
05a943c
d558494
d35032a
4f6ac33
f2b616e
7358cf6
acd53e7
2db8dc8
a0dda50
19716a5
811faa1
2460185
7c71493
5613006
a477d2d
9bedf04
aafc761
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,22 @@ | ||
# Makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = sphinx-build | ||
PAPER = | ||
INSTALLDIR = ../snappy/doc | ||
SPHINXBUILD = python -m sphinx | ||
|
||
# Internal variables. | ||
PAPEROPT_a4 = -D latex_paper_size=a4 | ||
PAPEROPT_letter = -D latex_paper_size=letter | ||
ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . | ||
|
||
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest install | ||
.PHONY: clean html | ||
|
||
help: | ||
@echo "Please use \`make <target>' where <target> is one of" | ||
@echo " html to make standalone HTML files" | ||
@echo " dirhtml to make HTML files named index.html in directories" | ||
@echo " pickle to make pickle files" | ||
@echo " json to make JSON files" | ||
@echo " htmlhelp to make HTML files and a HTML help project" | ||
@echo " qthelp to make HTML files and a qthelp project" | ||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" | ||
@echo " changes to make an overview of all changed/added/deprecated items" | ||
@echo " linkcheck to check all external links for integrity" | ||
@echo " doctest to run all doctests embedded in the documentation (if enabled)" | ||
@echo " install to install the documentation in the snappy module directory" | ||
@echo " clean to delete all generated files in _build" | ||
|
||
clean: | ||
-rm -rf _build/* | ||
|
||
# sphinx options: | ||
# -E forces it to rebuild the docs from scratch every time. | ||
# -d keeps the intermediate doctree files out the html directory. | ||
html: | ||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html | ||
@echo | ||
@echo "Build finished. The HTML pages are in _build/html." | ||
|
||
dirhtml: | ||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml | ||
@echo | ||
@echo "Build finished. The HTML pages are in _build/dirhtml." | ||
|
||
pickle: | ||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle | ||
@echo | ||
@echo "Build finished; now you can process the pickle files." | ||
|
||
json: | ||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json | ||
@echo | ||
@echo "Build finished; now you can process the JSON files." | ||
|
||
htmlhelp: | ||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp | ||
@echo | ||
@echo "Build finished; now you can run HTML Help Workshop with the" \ | ||
".hhp project file in _build/htmlhelp." | ||
|
||
qthelp: | ||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp | ||
@echo | ||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \ | ||
".qhcp project file in _build/qthelp, like this:" | ||
@echo "# qcollectiongenerator _build/qthelp/PLink.qhcp" | ||
@echo "To view the help file:" | ||
@echo "# assistant -collectionFile _build/qthelp/PLink.qhc" | ||
|
||
latex: | ||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex | ||
@echo | ||
@echo "Build finished; the LaTeX files are in _build/latex." | ||
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ | ||
"run these through (pdf)latex." | ||
|
||
changes: | ||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes | ||
$(SPHINXBUILD) -b html -E -d _build/doctrees . _build/doc | ||
cd _build && zip -rq snappy_doc.zip doc | ||
@echo | ||
@echo "The overview file is in _build/changes." | ||
|
||
linkcheck: | ||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck | ||
@echo | ||
@echo "Link check complete; look for any errors in the above output " \ | ||
"or in _build/linkcheck/output.txt." | ||
|
||
doctest: | ||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) _build/doctest | ||
@echo "Testing of doctests in the sources finished, look at the " \ | ||
"results in _build/doctest/output.txt." | ||
|
||
|
||
install: clean html | ||
rm -rf $(INSTALLDIR) | ||
mv _build/html $(INSTALLDIR) | ||
@echo "Installed docs in snappy directory" | ||
@echo "HTML build done. Result was _build/doc and _build/snappy_doc.zip." |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#! /usr/bin/env python3 | ||
|
||
""" | ||
Adds doc directory to exisiting wheel | ||
""" | ||
|
||
import subprocess | ||
import sys | ||
import os | ||
import tempfile | ||
import glob | ||
import shutil | ||
|
||
doc_zipfile = os.path.abspath(sys.argv[1]) | ||
wheel_path = os.path.abspath(sys.argv[2]) | ||
|
||
if not (doc_zipfile.endswith('.zip') and wheel_path.endswith('.whl')): | ||
raise ValueError('Usage: add_doc_to_wheel docs.zip snappy.whl') | ||
|
||
python = sys.executable | ||
tmp_dir = tempfile.mkdtemp() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with tempfile.TemporaryDirectory() as tmp_dir: might be more pythonic. Not sure whether cleaning up the tmp directory at the end is a feature (making debugging easier) or bug. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was intended to make debugging easier. |
||
subprocess.check_call([python, '-m', 'wheel', 'unpack', '--dest', tmp_dir, wheel_path]) | ||
pkg, version = os.path.basename(wheel_path).split('-')[:2] | ||
wheel_dir = os.path.join(tmp_dir, pkg + '-' + version) | ||
target = os.path.join(wheel_dir, pkg) | ||
target_doc_dir = os.path.join(target, 'doc') | ||
if os.path.exists(target_doc_dir): | ||
print('Deleting existing docs...') | ||
shutil.rmtree(target_doc_dir) | ||
print('Unpacking docs..') | ||
subprocess.check_call(['unzip', '-q', doc_zipfile, '-d', target]) | ||
subprocess.check_call([python, '-m', 'wheel', 'pack', '--dest', tmp_dir, wheel_dir]) | ||
new_whl = glob.glob(os.path.join(tmp_dir, pkg + '-' + version + '*.whl'))[0] | ||
if os.path.basename(new_whl) != os.path.basename(wheel_path): | ||
raise ValueError(f'Wheel tag changed, see {tmp_dir}') | ||
subprocess.check_call(['cp', new_whl, wheel_path]) | ||
print(f'Added docs to {os.path.basename(wheel_path)} in-place') | ||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
[build-system] | ||
requires = [ | ||
requires = ["setuptools", "wheel", "cython"] | ||
|
||
# True build dependenciees | ||
"setuptools>=42", | ||
"wheel", | ||
"cython>=0.28", | ||
|
||
# Install dependencies needed to build documentation | ||
"decorator", | ||
"FXrays", | ||
"low_index", | ||
"cypari", # Missing "--pre --extra-index-url https://test.pypi.org/simple" arguments from pip install | ||
"PLink @ git+https://github.com/3-manifolds/PLink", | ||
"snappy_manifolds @ git+https://github.com/3-manifolds/snappy_manifolds", | ||
"Spherogram @ git+https://github.com/3-manifolds/Spherogram", | ||
|
||
# Build dependencies to build documentation | ||
"sphinx", | ||
"sphinx_rtd_theme", | ||
] | ||
[tool.cibuildwheel] | ||
build = "cp312-macosx_*" | ||
test-command = "python -m snappy.test" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a mess to download all that stuff. Would it be hard to install zip in the container temporarily?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
upload-artifact
action automatically puts the files in a single zipfile for easy download.