From 53949cde85c8f68daab864ae4cefc09160bc19e8 Mon Sep 17 00:00:00 2001 From: Chris Rossi Date: Fri, 13 Jan 2012 10:57:20 -0500 Subject: [PATCH] Get pyramid theme automatically. --- docs/conf.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 5af6928..ed19247 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -87,6 +87,36 @@ unused_docs = ['_themes/README'] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' +# 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)) # Options for HTML output # -----------------------