- use package pylons-sphinx-themes instead of git submodule to build docs

- in docs/conf.py, use dynamic values in subs to save manual updates
- Fixes #221
This commit is contained in:
Steve Piercy 2015-05-06 00:35:52 -07:00
parent 267dd51aa3
commit b79d3a06b3
4 changed files with 21 additions and 46 deletions

View File

@ -12,7 +12,9 @@
# All configuration values have a default value; values that are commented # All configuration values have a default value; values that are commented
# out serve to show the default value. # out serve to show the default value.
import sys, os import sys, os, datetime
import pkg_resources
import pylons_sphinx_themes
# General configuration # General configuration
# --------------------- # ---------------------
@ -32,13 +34,14 @@ master_doc = 'index'
# General substitutions. # General substitutions.
project = 'colander' project = 'colander'
copyright = '2012, Agendaless Consulting <pylons-discuss@googlegroups.com>' thisyear = datetime.datetime.now().year
copyright = '2012-%s, Agendaless Consulting <pylons-discuss@googlegroups.com>' % thisyear
# The default replacements for |version| and |release|, also used in various # The default replacements for |version| and |release|, also used in various
# other places throughout the built documents. # other places throughout the built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '1.0b1' version = pkg_resources.get_distribution('colander').version
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = version release = version
@ -49,7 +52,7 @@ release = version
today_fmt = '%B %d, %Y' today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build. # List of documents that shouldn't be included in the build.
unused_docs = ['_themes/README'] #unused_docs = ['_themes/README']
# List of directories, relative to source directories, that shouldn't be # List of directories, relative to source directories, that shouldn't be
# searched for source files. # searched for source files.
@ -73,43 +76,11 @@ unused_docs = ['_themes/README']
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx' 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 # Options for HTML output
# ----------------------- # -----------------------
# sys.path.append(os.path.abspath('_themes'))
sys.path.append(os.path.abspath('_themes')) html_theme = 'pyramid'
html_theme_path = ['_themes'] html_theme_path = pylons_sphinx_themes.get_html_themes_path()
html_theme = 'pylons'
html_theme_options = dict(github_url='https://github.com/Pylons/colander') html_theme_options = dict(github_url='https://github.com/Pylons/colander')
# The style sheet to use for HTML and HTML Help pages. A file of that name # The style sheet to use for HTML and HTML Help pages. A file of that name
@ -146,7 +117,7 @@ html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to # If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities. # typographically correct entities.
#html_use_smartypants = True html_use_smartypants = False
# Custom sidebar templates, maps document names to template names. # Custom sidebar templates, maps document names to template names.
#html_sidebars = {} #html_sidebars = {}
@ -177,7 +148,7 @@ html_last_updated_fmt = '%b %d, %Y'
#html_file_suffix = '' #html_file_suffix = ''
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'atemplatedoc' htmlhelp_basename = 'colanderdoc'
# Options for LaTeX output # Options for LaTeX output
@ -193,7 +164,7 @@ htmlhelp_basename = 'atemplatedoc'
# (source start file, target name, title, # (source start file, target name, title,
# author, document class [howto/manual]). # author, document class [howto/manual]).
latex_documents = [ latex_documents = [
('index', 'atemplate.tex', 'colander Documentation', ('index', 'colander.tex', 'colander Documentation',
'Pylons Developers', 'manual'), 'Pylons Developers', 'manual'),
] ]

1
rtd.txt Normal file
View File

@ -0,0 +1 @@
-e .[docs]

View File

@ -33,7 +33,11 @@ except:
requires = ['translationstring', 'iso8601'] requires = ['translationstring', 'iso8601']
testing_extras = ['nose', 'coverage'] testing_extras = ['nose', 'coverage']
docs_extras = ['Sphinx'] docs_extras = [
'Sphinx >= 1.3.1',
'docutils',
'pylons-sphinx-themes',
]
setup(name='colander', setup(name='colander',
version='1.1.dev0', version='1.1.dev0',

View File

@ -20,7 +20,6 @@ deps =
[testenv:docs] [testenv:docs]
basepython = basepython =
python2.7 python2.7
commands = commands =
pip install colander[docs]
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
deps =
Sphinx