Commits

Josh VanderLinden committed a612253

Updating the project for newer versions of Sphinx and Mercurial

  • Participants
  • Parent commits 12f4859

Comments (0)

Files changed (4)

 # HG changeset patch
-# Parent 1d3915c21216e04840607d0c04f4a79c93c9a0a1
+# Parent 8300548579e43167adf173c74eac06dce69c67ab
 
-diff -r 1d3915c21216 hgblog/generate_html.py
+diff -r 8300548579e4 hgblog/generate_html.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/hgblog/generate_html.py	Mon Apr 26 16:06:16 2010 -0400
++++ b/hgblog/generate_html.py	Fri Sep 30 01:32:49 2011 -0400
 @@ -0,0 +1,7 @@
 +from hgblog.refresh import refresh
 +
 +
 +    refresh(repo)
 +
-diff -r 1d3915c21216 hgblog/refresh.py
---- a/hgblog/refresh.py	Mon Apr 26 13:21:40 2010 -0400
-+++ b/hgblog/refresh.py	Mon Apr 26 16:06:16 2010 -0400
+diff -r 8300548579e4 hgblog/refresh.py
+--- a/hgblog/refresh.py	Fri Sep 30 00:59:01 2011 -0400
++++ b/hgblog/refresh.py	Fri Sep 30 01:32:49 2011 -0400
 @@ -1,19 +1,15 @@
 -from mercurial.match import match
 -from mercurial.ui import ui
  
      # tell Sphinx to HTML-ize the .rst files we found
      args = [
-diff -r 1d3915c21216 hgblog/utils.py
---- a/hgblog/utils.py	Mon Apr 26 13:21:40 2010 -0400
-+++ b/hgblog/utils.py	Mon Apr 26 16:06:16 2010 -0400
-@@ -1,9 +1,48 @@
+diff -r 8300548579e4 hgblog/utils.py
+--- a/hgblog/utils.py	Fri Sep 30 00:59:01 2011 -0400
++++ b/hgblog/utils.py	Fri Sep 30 01:32:49 2011 -0400
+@@ -1,9 +1,49 @@
 -from mercurial.cmdutil import findrepo
 -from mercurial import hg
 -from mercurial.ui import ui
 +def get_tracked_rst_files(repo=None):
 +    """Returns a list of .rst files that are under version control"""
 +
-+    #from mercurial.match import match
-+    from mercurial.cmdutil import match
++    from mercurial.match import match
 +
 +    if repo is None:
 +        repo = get_repo()
 +
-+    m = match(repo, ('*.rst',), {}, default='relglob')
++    m = match(repo, '.', ('*.rst',), {}, default='relglob')
 +    tracked = filter(lambda f: f in repo.dirstate, repo[None].walk(m))
 +    return [os.path.join(repo.root, f) for f in tracked]
 +
 +def get_untracked_rst_files(repo=None):
-+    """Returns a list of all .rst files that are not currently tracked by
-+    Mercurial"""
++    """
++    Returns a list of all .rst files that are not currently tracked by
++    Mercurial
++    """
 +
 +    if repo is None:
 +        repo = get_repo()

File quickstart.patch

 # HG changeset patch
-# Parent 5350c56aeddb2cfe306b5c5691b86a1d1a2889e9
+# Parent 9acbf8c69f2f53cce827d8d130a42ac64d36af89
 
-diff -r 5350c56aeddb setup.py
---- a/setup.py	Mon Jun 07 17:12:14 2010 -0400
-+++ b/setup.py	Mon Jun 07 17:12:54 2010 -0400
-@@ -45,7 +45,7 @@ A development egg can be found `here
+diff -r 9acbf8c69f2f setup.py
+--- a/setup.py	Fri Sep 30 00:48:18 2011 -0400
++++ b/setup.py	Fri Sep 30 00:56:12 2011 -0400
+@@ -45,7 +45,7 @@
  <http://bitbucket.org/birkenfeld/sphinx/get/tip.gz#egg=Sphinx-dev>`_.
  '''
  
--requires = ['Pygments>=0.8', 'Jinja2>=2.2', 'docutils>=0.5']
-+requires = ['Pygments>=0.8', 'Jinja2>=2.2', 'docutils>=0.5', 'mercurial>=1.5']
+-requires = ['Pygments>=1.2', 'Jinja2>=2.3', 'docutils>=0.7']
++requires = ['Pygments>=1.2', 'Jinja2>=2.3', 'docutils>=0.7', 'mercurial>=1.9.1']
  
  if sys.version_info < (2, 4):
-     print 'ERROR: Sphinx requires at least Python 2.4 to run.'
-diff -r 5350c56aeddb sphinx/quickstart.py
---- a/sphinx/quickstart.py	Mon Jun 07 17:12:14 2010 -0400
-+++ b/sphinx/quickstart.py	Mon Jun 07 17:12:54 2010 -0400
-@@ -19,6 +19,7 @@ from sphinx.util.osutil import make_file
+     print('ERROR: Sphinx requires at least Python 2.4 to run.')
+diff -r 9acbf8c69f2f sphinx/quickstart.py
+--- a/sphinx/quickstart.py	Fri Sep 30 00:48:18 2011 -0400
++++ b/sphinx/quickstart.py	Fri Sep 30 00:56:12 2011 -0400
+@@ -20,6 +20,7 @@
  from sphinx.util.console import purple, bold, red, turquoise, \
       nocolor, color_terminal
  from sphinx.util import texescape
 +from mercurial import commands as HG_commands, ui as HG_ui, hg as HG
  
- 
- PROMPT_PREFIX = '> '
-@@ -27,7 +28,7 @@ QUICKSTART_CONF = '''\
+ # function to get input from terminal -- overridden by the test suite
+ try:
+@@ -41,7 +42,7 @@
  # -*- coding: utf-8 -*-
  #
  # %(project)s documentation build configuration file, created by
  #
  # This file is execfile()d with the current directory set to its containing dir.
  #
-@@ -66,17 +67,19 @@ source_suffix = '%(suffix)s'
+@@ -80,17 +81,19 @@
  master_doc = '%(master_str)s'
  
  # General information about the project.
  
  # The language for content autogenerated by Sphinx. Refer to documentation
  # for a list of supported languages.
-@@ -90,7 +93,12 @@ release = '%(release_str)s'
+@@ -104,7 +107,12 @@
  
  # List of patterns, relative to source directory, that match files and
  # directories to ignore when looking for source files.
  
  # The reST default role (used for this markup: `text`) to use for all documents.
  #default_role = None
-@@ -117,7 +125,7 @@ pygments_style = 'sphinx'
+@@ -131,7 +139,7 @@
  
  # The theme to use for HTML and HTML Help pages.  See the documentation for
  # a list of builtin themes.
  
  # Theme options are theme-specific and customize the look and feel of a theme
  # further.  For a list of options available for each theme, see the
-@@ -129,7 +137,7 @@ html_theme = 'default'
+@@ -143,7 +151,7 @@
  
  # The name for this set of Sphinx documents.  If None, it defaults to
  # "<project> v<release> documentation".
  
  # A shorter title for the navigation bar.  Default is the same as html_title.
  #html_short_title = None
-@@ -238,7 +246,7 @@ latex_documents = [
- # (source start file, name, description, authors, manual section).
- man_pages = [
-     ('%(master_str)s', '%(project_manpage)s', u'%(project_doc)s',
--     [u'%(author_str)s'], 1)
-+     [u"""%(author_str)s"""], 1)
- ]
- '''
- 
-@@ -247,10 +255,10 @@ EPUB_CONFIG = '''
+@@ -286,10 +294,10 @@
  # -- Options for Epub output ---------------------------------------------------
  
  # Bibliographic Dublin Core info.
  
  # The language of the text. It defaults to the language option
  # or en if the language is not set.
-@@ -288,35 +296,43 @@ intersphinx_mapping = {'http://docs.pyth
+@@ -333,35 +341,43 @@
  '''
  
  MASTER_FILE = '''\
  PAPER         =
  BUILDDIR      = %(rbuilddir)s
  
-@@ -453,7 +469,7 @@ BATCHFILE = '''\
+@@ -521,7 +537,7 @@
  REM Command file for Sphinx documentation
  
  if "%%SPHINXBUILD%%" == "" (
  )
  set BUILDDIR=%(rbuilddir)s
  set ALLSPHINXOPTS=-d %%BUILDDIR%%/doctrees %%SPHINXOPTS%% %(rsrcdir)s
-@@ -677,27 +693,35 @@ def do_prompt(d, key, text, default=None
+@@ -794,19 +810,28 @@
  
  
  def inner_main(args):
      if not color_terminal():
          nocolor()
  
+     if len(args) > 3:
+-        print 'Usage: sphinx-quickstart [root]'
++        print 'Usage: hgblog-quickstart [root]'
+         sys.exit(1)
+     elif len(args) == 2:
+         d['path'] = args[1]
+ 
 -    print bold('Welcome to the Sphinx %s quickstart utility.') % __version__
 +    print bold('Welcome to the HgBlog %s quickstart utility.') % __version__
      print '''
  Please enter values for the following settings (just press Enter to
--accept a default value, if one is given in brackets).'''
-+accept a default value, if one is given in brackets).
- 
--    print '''
+ accept a default value, if one is given in brackets).'''
+@@ -816,15 +841,15 @@
+ Selected root path: %s''' % d['path'])
+     else:
+         print '''
 -Enter the root path for documentation.'''
--    do_prompt(d, 'path', 'Root path for the documentation', '.', is_path)
+-        do_prompt(d, 'path', 'Root path for the documentation', '.', is_path)
 +Enter the root path for your blog articles.'''
-+    do_prompt(d, 'path', 'Root path for your blog articles', '.', is_path)
++        do_prompt(d, 'path', 'Root path for the your blog articles', '.', is_path)
  
      while path.isfile(path.join(d['path'], 'conf.py')) or \
            path.isfile(path.join(d['path'], 'source', 'conf.py')):
          print
          do_prompt(d, 'path', 'Please enter a new root path (or just Enter '
                    'to exit)', '', is_path)
-@@ -705,56 +729,14 @@ Enter the root path for documentation.''
+@@ -832,69 +857,17 @@
              sys.exit(1)
  
      print '''
  
      print '''
  Please indicate if you want to use one of the following Sphinx extensions:'''
-@@ -781,7 +763,7 @@ pngmath has been deselected.'''
+-    do_prompt(d, 'ext_autodoc', 'autodoc: automatically insert docstrings '
+-              'from modules (y/N)', 'n', boolean)
+-    do_prompt(d, 'ext_doctest', 'doctest: automatically test code snippets '
+-              'in doctest blocks (y/N)', 'n', boolean)
+-    do_prompt(d, 'ext_intersphinx', 'intersphinx: link between Sphinx '
+-              'documentation of different projects (y/N)', 'n', boolean)
+-    do_prompt(d, 'ext_todo', 'todo: write "todo" entries '
+-              'that can be shown or hidden on build (y/N)', 'n', boolean)
+-    do_prompt(d, 'ext_coverage', 'coverage: checks for documentation '
+-              'coverage (y/N)', 'n', boolean)
+     do_prompt(d, 'ext_pngmath', 'pngmath: include math, rendered '
+               'as PNG images (y/N)', 'n', boolean)
+     do_prompt(d, 'ext_jsmath', 'jsmath: include math, rendered in the '
+@@ -908,7 +881,7 @@
                'of documented Python objects (y/N)', 'n', boolean)
      print '''
  A Makefile and a Windows command file can be generated for you so that you
  directly.'''
      do_prompt(d, 'makefile', 'Create Makefile? (Y/n)', 'y', boolean)
      do_prompt(d, 'batchfile', 'Create Windows command file? (Y/n)',
-@@ -799,19 +781,42 @@ directly.'''
+@@ -920,26 +893,46 @@
+     d['underline'] = len(d['project']) * '='
+     d['extensions'] = ', '.join(
+         repr('sphinx.ext.' + name)
+-        for name in ('autodoc', 'doctest', 'intersphinx', 'todo', 'coverage',
+-                     'pngmath', 'jsmath', 'ifconfig', 'viewcode')
++        for name in ('pngmath', 'jsmath', 'ifconfig', 'viewcode')
+         if d['ext_' + name])
      d['copyright'] = time.strftime('%Y') + ', ' + d['author']
      d['author_texescaped'] = unicode(d['author']).\
                               translate(texescape.tex_escape_map)
  
      # escape backslashes and single quotes in strings that are put into
      # a Python string literal
-     for key in ('project', 'copyright', 'author', 'author_texescaped',
--                'project_doc_texescaped', 'version', 'release', 'master'):
-+                'project_doc_texescaped', 'version', 'release', 'master',
-+                'disqus_site'):
+     for key in ('project', 'project_doc', 'project_doc_texescaped',
+                 'author', 'author_texescaped', 'copyright',
+-                'version', 'release', 'master'):
++                'version', 'release', 'master', 'disqus_site'):
          d[key + '_str'] = d[key].replace('\\', '\\\\').replace("'", "\\'")
  
      if not path.isdir(d['path']):
          mkdir_p(d['path'])
  
-+    # Create a mercurial repo
++    # create a Mercurial repo
 +    hg_ui = HG_ui.ui()
 +    HG_commands.init(hg_ui, d['path'])
 +    hg_repo = HG.repository(hg_ui, d['path'])
 +
-+    # Create an ignores file for HG
++    # create an ignores file for Hg
 +    ignores = path.join(d['path'], '.hgignore')
 +    open(ignores, 'w').write('''syntax: glob
 +*.swp
 +*.swo
 +*~
-+build
-+.DS_Store
-+''')
++*build
++.DS_Store''')
 +
-+    # Add our hooks
++    # add our hooks
 +    hooks = path.join(d['path'], '.hg', 'hgrc')
 +    open(hooks, 'w').write('''[hooks]
 +update.hgblog = python:hgblog.generate_html.htmlize_articles
      srcdir = d['sep'] and path.join(d['path'], 'source') or d['path']
  
      mkdir_p(srcdir)
-@@ -840,6 +845,11 @@ directly.'''
-     f.write((MASTER_FILE % d).encode('utf-8'))
+@@ -956,8 +949,6 @@
+     conf_text = QUICKSTART_CONF % d
+     if d['epub']:
+         conf_text += EPUB_CONFIG % d
+-    if d['ext_intersphinx']:
+-        conf_text += INTERSPHINX_CONFIG
+ 
+     f = open(path.join(srcdir, 'conf.py'), 'w', encoding='utf-8')
+     f.write(conf_text)
+@@ -968,6 +959,11 @@
+     f.write(MASTER_FILE % d)
      f.close()
  
 +    aboutfile = path.join(srcdir, 'about%s' % d['suffix'])
      if d['makefile']:
          d['rsrcdir'] = d['sep'] and 'source' or '.'
          d['rbuilddir'] = d['sep'] and 'build' or d['dot'] + 'build'
-@@ -855,20 +865,13 @@ directly.'''
-         f.write((BATCHFILE % d).encode('utf-8'))
+@@ -983,20 +979,13 @@
+         f.write(BATCHFILE % d)
          f.close()
  
 +    # Add the newest files to the repo

File readme.patch

 # HG changeset patch
-# Parent 717b554a4598d9666e902c4b6fc3ad7ab9398c2a
+# Parent d1b18afa823cedfccce1294f5b436f34c9822a77
 
-diff -r 717b554a4598 README
---- a/README	Sat Apr 24 21:51:29 2010 -0400
-+++ b/README	Sat Apr 24 21:53:40 2010 -0400
-@@ -1,33 +1,190 @@
+diff -r d1b18afa823c README
+--- a/README	Fri Sep 30 00:26:34 2011 -0400
++++ b/README	Fri Sep 30 00:29:43 2011 -0400
+@@ -1,44 +1,190 @@
  .. -*- restructuredtext -*-
  
 -=================
  
 -Installing
 -==========
-+HgBlog is a set of modifications to the Sphinx project to make it slightly more 
++HgBlog is a set of modifications to the Sphinx project to make it slightly more
 +suitable as a blogging engine.  It's built for those of us who love using
 +reStructuredText markup to write documents.
  
 +   if you've never used it or are unfamiliar with how Mercurial affects your
 +   life.
  
--    python setup.py build
--    sudo python setup.py install
+-   python setup.py build
+-   sudo python setup.py install
 +The quickstart wizard handles setting up an HgBlog for you.  This includes all
 +of the usual things that the Sphinx quickstart utility does, but it creates a
 +Mercurial repository and installs a hook and intelligent ignores for you.  The
 +hook will automatically convert the ``.rst`` files that Mercurial is tracking
 +into HTML using Sphinx when you commit changes to the repository.
  
-+Additionally, when you pull changes in from a remote clone of the repository, 
++Additionally, when you pull changes in from a remote clone of the repository,
 +the hook will do the conversion just like when you commit locally.  You can set
 +the hook up on remote clones as well.  The hook *only* converts ``.rst`` files
-+that are tracked by Mercurial.  This means you can work on new blog articles 
++that are tracked by Mercurial.  This means you can work on new blog articles
 +without committing them to the repository to have them not appear online.
  
 -Reading the docs
 +===============================================
  
 -After installing::
-+Yes, there are.  And most of them rely on databases that require regular 
++Yes, there are.  And most of them rely on databases that require regular
 +maintenance and backup.  Databases can also slow down your blog.  HgBlog offers
 +you a way to serve up your blog articles as static HTML without the overhead
 +of requesting an object from a database, making it fit into a layout, etc.
 +Any webserver should be perfectly capable of serving the content generated by
 +HgBlog.
  
--    cd doc
--    sphinx-build . _build/html
+-   cd doc
+-   sphinx-build . _build/html
 +I'm not saying there's anything wrong with database-backed blogs.  I maintain
 +my own blog that is Django powered (and database-backed).  It works fine for
 +me.  However, some people might not want to be confined to the rules imposed
 +What does HgBlog offer you that *should* be attractive?
  
 -Or read them online at <http://sphinx.pocoo.org>.
-+* **Speed**.  No need to deal with the formatting headaches of whatever 
-+  WYSIWYG editor your blogging engine has dictated is the best.  Just use 
++* **Speed**.  No need to deal with the formatting headaches of whatever
++  WYSIWYG editor your blogging engine has dictated is the best.  Just use
 +  reStructuredText markup (which is quite easy to learn if you've never used
 +  it before) and let Sphinx worry about formatting it.
 +* **Consistency**.  Again, reStructuredText is a very simple format that will
 +    * Plain text
 +    * man pages
  
--Contributing
+-Testing
+-=======
 +  With other tools, you can even turn your ``.rst`` files into PDF or ODT
 +  documents.
 +* **Redundancy**. Since every article you want to have on your blog must be
 +  a very fast and effective way to backup your articles.  If the primary
 +  "server" for your blog ever dies, you are likely to have at least one full,
 +  up-to-date backup of your blog if you're using Mercurial as it's designed.
-+
+ 
+-To run the tests with the interpreter available as ``python``, use::
 +Possible Workflows
 +==================
-+
-+* You have a server which offers Python and SSH access, and you're allowed to 
-+  install your own software within your home directory (or you have full root 
+ 
+-    make test
++* You have a server which offers Python and SSH access, and you're allowed to
++  install your own software within your home directory (or you have full root
 +  access to install elsewhere).  Run the quickstart utility on your server,
-+  clone the repository onto your local machine, write articles, commit them, 
++  clone the repository onto your local machine, write articles, commit them,
 +  push them up to your server.  When you're ready for those articles to appear
-+  online, simply run ``hg up`` on the repository on your server.  Make sure your 
++  online, simply run ``hg up`` on the repository on your server.  Make sure your
 +  webserver software is configured to serve static content from your ``build/html``
 +  directory.
 +* Use HgBlog to produce your own, personal wiki.  Keep notes on things you do at
 +  work or projects you're currently working on.
-+* Don't have a server that supports ASP, PHP, Ruby, Python, or whatever 
++* Don't have a server that supports ASP, PHP, Ruby, Python, or whatever
 +  language you prefer?  Use HgBlog to compose your articles locally, commit
 +  changes to the ``.rst`` files, and use an FTP program to upload the HTML
 +  files to your hosting provider.
-+
+ 
+-If you want to use a different interpreter, e.g. ``python3``, use::
+-
+-    PYTHON=python3 make test
+-
+-
+-Contributing
 +Requirements
  ============
  
 +Sphinx 1.0-pre, docutils 0.6, Jinja2 2.4.1, and Pygments 1.3.1.  However,
 +Sphinx suggests the following version requirements.  I'm just being safe with
 +my requirement on Mercurial's version.
- 
++
 +* Python 2.4+
 +* docutils 0.4+
 +* Jinja2 2.2+
 +Getting Started
 +===============
 +
-+HgBlog leverages the existing quickstart wizard for Sphinx projects.  There 
++HgBlog leverages the existing quickstart wizard for Sphinx projects.  There
 +are some modifications to reduce the number of steps required, so you should
 +be able to be up and running within a minute using::
 +
 +* Provide your name
 +* Select any extensions you may want to include in your blog
 +
-+Once you do that, you should have a few new directories, one of which will be 
++Once you do that, you should have a few new directories, one of which will be
 +called ``source``.  This is where you should write your ``.rst`` articles.  When
 +you're done working on a particular article, you can use::
 +
 +
 +    hgblog-refresh
 +
-+You should be able to call that from anywhere within your blog's Mercurial 
++You should be able to call that from anywhere within your blog's Mercurial
 +repository, and your HTML files should be properly refreshed.
 +
 +TODOs

File rename_files.patch

 # HG changeset patch
-# Parent 04464ddd8808c655110c8203a7cbd712df54ddbc
+# Parent be2c6c835b74f8d70b085f38d51ae51787f4b07a
 
 diff --git a/.hgignore b/.hgignore
 --- a/.hgignore
 +++ b/.hgignore
-@@ -14,3 +14,4 @@
+@@ -15,6 +15,7 @@
  ^env/
  \.DS_Store$
  ~$
 +.*\.swp
+ ^utils/.*3\.py$
+ ^distribute-
+ ^tests/root/_build/*
 diff --git a/README b/README
 --- a/README
 +++ b/README
-@@ -23,7 +23,7 @@ After installing::
+@@ -23,7 +23,7 @@
  
  Then, direct your browser to ``_build/html/index.html``.
  
 +Or read them online at <http://sphinx.pocoo.org>.
  
  
- Contributing
+ Testing
 diff --git a/README.rst b/README.rst
 new file mode 120000
 --- /dev/null
 @@ -0,0 +1,4 @@
 +from server import serve
 +
-+__version__ = '0.5'
++__version__ = '0.7'
 +
 diff --git a/hgblog/refresh.py b/hgblog/refresh.py
 new file mode 100644
 diff --git a/setup.py b/setup.py
 --- a/setup.py
 +++ b/setup.py
-@@ -10,6 +10,7 @@ import os
+@@ -10,6 +10,7 @@
  import sys
  from distutils import log
  
  import sphinx
  
  long_desc = '''
-@@ -159,15 +160,15 @@ else:
+@@ -162,15 +163,15 @@
  
  
  setup(
      zip_safe=False,
      classifiers=[
          'Development Status :: 5 - Production/Stable',
-@@ -187,12 +188,14 @@ setup(
+@@ -191,13 +192,15 @@
      include_package_data=True,
      entry_points={
          'console_scripts': [
 -            'sphinx-build = sphinx:main',
 -            'sphinx-quickstart = sphinx.quickstart:main',
+-            'sphinx-apidoc = sphinx.apidoc:main',
 -            'sphinx-autogen = sphinx.ext.autosummary.generate:main',
 +            'hgblog-build = sphinx:main',
 +            'hgblog-quickstart = sphinx.quickstart:main',
++            'hgblog-apidoc = sphinx.apidoc:main',
 +            'hgblog-autogen = sphinx.ext.autosummary.generate:main',
 +            'hgblog-serve = hgblog.server:serve',
 +            'hgblog-refresh = hgblog.refresh:refresh',