Skip to content

Commit

Permalink
gh-pages.py no longer updates index.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Feb 15, 2011
1 parent 33e87e7 commit 5285c57
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 44 deletions.
4 changes: 0 additions & 4 deletions docs/Makefile
Expand Up @@ -105,7 +105,3 @@ nightly: dist


gh-pages: html pdf gh-pages: html pdf
python gh-pages.py python gh-pages.py

gh-pages-current: html pdf
ipver="$(ipython -v 2>&1)"
python gh-pages.py dev "Current Development Version ($ipver)"
38 changes: 1 addition & 37 deletions docs/gh-pages.py
Expand Up @@ -74,34 +74,6 @@ def init_repo(path):
sh('git checkout gh-pages') sh('git checkout gh-pages')
cd(here) cd(here)



def render_rstindex(fname, tag, desc=None):
if desc is None:
desc = tag

rel = '* {d}: `HTML <{t}/index.html>`_ and `PDF <{t}/ipython.pdf>`_.'.format(t=tag,d=desc)
rep = re.compile(r'\.\. release')
out = []
with file(fname) as f:
contents = f.read()
lines = contents.splitlines()
if rel in contents:
out = lines
else:
for line in lines:
out.append(line)
if rep.search(line):
out.append(rep.sub(rel, line))
return '\n'.join(out)+'\n'


def new_rstindex(fname, tag, desc=None):
new_page = render_rstindex(fname, tag, desc)
os.rename(fname, fname+'~')
with file(fname, 'w') as f:
f.write(new_page)


#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Script starts # Script starts
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
Expand All @@ -115,11 +87,6 @@ def new_rstindex(fname, tag, desc=None):
except CalledProcessError: except CalledProcessError:
tag = "dev" # Fallback tag = "dev" # Fallback


try:
desc = sys.argv[2]
except IndexError:
desc="Release (%s)"%tag

startdir = os.getcwd() startdir = os.getcwd()
if not os.path.exists(pages_dir): if not os.path.exists(pages_dir):
# init the repo # init the repo
Expand Down Expand Up @@ -152,10 +119,7 @@ def new_rstindex(fname, tag, desc=None):
raise RuntimeError(e) raise RuntimeError(e)


sh('git add %s' % tag) sh('git add %s' % tag)
new_rstindex('index.rst', tag, desc) sh('git commit -m"Updated doc release: %s"' % tag)
sh('python build_index.py')
sh('git add index.rst index.html')
sh('git commit -m"Created new doc release, named: %s"' % tag)
print print
print 'Most recent 3 commits:' print 'Most recent 3 commits:'
sys.stdout.flush() sys.stdout.flush()
Expand Down
8 changes: 5 additions & 3 deletions docs/source/development/doc_guide.txt
Expand Up @@ -149,12 +149,14 @@ they're automatically exposed as a website. It works like this:
version of the docs repository, copy the built docs into it, and commit your version of the docs repository, copy the built docs into it, and commit your
changes. changes.
* Open the built docs in a web browser, and check that they're as expected. * Open the built docs in a web browser, and check that they're as expected.
* (If rebuilding the docs for the development version, it may have duplicated * (When building the docs for a new tagged release, you will have to add its link to
the link to the development version in the homepage. Remove this from index.rst, then run ``python build_index.py`` to update index.html. Commit the
index.rst, then run ``python build_index.py`` to update index.html. Commit the
change.) change.)
* Upload the docs with ``git push``. This only works if you have write access to * Upload the docs with ``git push``. This only works if you have write access to
the docs repository. the docs repository.
* If you are building a version that is not the current dev branch, nor a tagged release,
then you must run gh-pages.py directly with ``python gh-pages.py <version>``, and *not*
with ``make gh-pages``.


.. [reStructuredText] reStructuredText. http://docutils.sourceforge.net/rst.html .. [reStructuredText] reStructuredText. http://docutils.sourceforge.net/rst.html
.. [Sphinx] Sphinx. http://sphinx.pocoo.org/ .. [Sphinx] Sphinx. http://sphinx.pocoo.org/
Expand Down

0 comments on commit 5285c57

Please sign in to comment.