Skip to content

Commit

Permalink
Finally fixed the extlinks:example in doc/conf.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-ntrf committed Aug 28, 2014
1 parent 63b82df commit 6db0685
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,19 @@
# -- Options for extlinks extension ----------------------------------------------

with open("../.git/HEAD", 'r') as git_head:
line = git_head.readline()
print(line)
branch_name = line.split('/')[2].strip()

extlinks = {'example': ('https://github.com/DEAP/deap/blob/%s/examples/%%s.py' % branch_name, "examples/")}
head_content = git_head.readline().strip()
head_split = head_content.split('/')
# The head is fixed to a commit hash
if len(head_split) == 1:
tree = head_split
# The head corresponds to a branch
elif len(head_split) == 3:
tree = head_split[2]
# No idea what is going on here...
else:
tree = 'master'

extlinks = {'example': ('https://github.com/DEAP/deap/blob/{tree}/examples/%s.py'.format(tree=tree), "examples/")}
# -- Options for HTML output ---------------------------------------------------

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

0 comments on commit 6db0685

Please sign in to comment.