Skip to content

Commit

Permalink
use pyramid-like docs config
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Feb 15, 2012
1 parent 9d82f14 commit 6118ad5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
1 change: 1 addition & 0 deletions docs/.gitignore
@@ -1 +1,2 @@
_build/
_themes/
8 changes: 3 additions & 5 deletions docs/Makefile
Expand Up @@ -2,7 +2,7 @@
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXOPTS = -W
SPHINXBUILD = sphinx-build
PAPER =

Expand All @@ -25,7 +25,7 @@ help:
clean:
-rm -rf _build/*

html: _themes
html:
mkdir -p _build/html _build/doctrees
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
@echo
Expand All @@ -47,7 +47,7 @@ pickle:

web: pickle

htmlhelp: _themes
htmlhelp:
mkdir -p _build/htmlhelp _build/doctrees
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
@echo
Expand Down Expand Up @@ -84,5 +84,3 @@ epub:
@echo
@echo "Build finished. The epub file is in _build/epub."

_themes:
cd ..; git submodule update --init; cd docs
42 changes: 31 additions & 11 deletions docs/conf.py
Expand Up @@ -19,16 +19,36 @@
# make it absolute, like shown here.
#sys.path.append(os.path.abspath('some/directory'))

parent = os.path.dirname(os.path.dirname(__file__))
sys.path.append(os.path.abspath(parent))
wd = os.getcwd()
os.chdir(parent)
os.system('%s setup.py test -q' % sys.executable)
os.chdir(wd)

for item in os.listdir(parent):
if item.endswith('.egg'):
sys.path.append(os.path.join(parent, item))
# Add and use Pylons theme
if 'sphinx-build' in ' '.join(sys.argv): # protect against dumb importers
from subprocess import call, Popen, PIPE

p = Popen('which git', shell=True, stdout=PIPE)
git = p.stdout.read().strip()
cwd = os.getcwd()
_themes = os.path.join(cwd, '_themes')

if not os.path.isdir(_themes):
call([git, 'clone', 'git://github.com/Pylons/pylons_sphinx_theme.git',
'_themes'])
else:
os.chdir(_themes)
call([git, 'checkout', 'master'])
call([git, 'pull'])
os.chdir(cwd)

sys.path.append(os.path.abspath('_themes'))

parent = os.path.dirname(os.path.dirname(__file__))
sys.path.append(os.path.abspath(parent))
wd = os.getcwd()
os.chdir(parent)
os.system('%s setup.py test -q' % sys.executable)
os.chdir(wd)

for item in os.listdir(parent):
if item.endswith('.egg'):
sys.path.append(os.path.join(parent, item))

# General configuration
# ---------------------
Expand Down Expand Up @@ -104,7 +124,7 @@
sys.path.append(os.path.abspath('_themes'))
html_theme_path = ['_themes']
html_theme = 'pylons'
html_theme_options = {'github_url':'http://github.com/Pylons/deform'}
html_theme_options = dict(github_url='https://github.com/Pylons/deform')

# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
Expand Down

0 comments on commit 6118ad5

Please sign in to comment.