Skip to content
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

Fix building of docs with the lastest numpy and sphinx #709

Merged
merged 14 commits into from
Jul 24, 2023
Prev Previous commit
Next Next commit
setup: fix git invocation for exlinks, add override
The 'tree' would be bytes, so we'd end up with an url like
https://github.com/DEAP/deap/blob/b'0123456'/examples/.

While at it, allow the user to override the detect hash. This is particularly
useful when there are local modifications, and HEAD hash doesn't yet exist on
github, and it's nicer to link to some other commit, or even 'master'.

Also, sphinx 6 enforces the second item in the extlinks tuple (the title)
to have exactly one '%s'.
  • Loading branch information
keszybz committed Jul 17, 2023
commit b87ba7f941a366da17edc5590b2d42d1659cb989
18 changes: 10 additions & 8 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, time
import sys, time, os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -128,13 +128,15 @@

# -- Options for extlinks extension ----------------------------------------------
import subprocess
try:
tree = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip()
except OSError:
import warnings
warnings.warn("Cannot link examples because we cannot retrieve the git version", Warning)
else:
extlinks = {'example': ('https://github.com/DEAP/deap/blob/{tree}/examples/%s.py'.format(tree=tree), "examples/")}
tree = os.getenv('GITHUB_COMMIT')
if tree is None:
try:
tree = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip()
except OSError:
import warnings
warnings.warn("Cannot link examples because we cannot retrieve the git version", Warning)
if tree:
extlinks = {'example': ('https://github.com/DEAP/deap/blob/{tree}/examples/%s.py'.format(tree=tree), "examples/%s")}
# -- Options for HTML output ---------------------------------------------------

# Add any paths that contain custom themes here, relative to this directory.
Expand Down