STYLE: Document SlicerWizard/TemplateManager.py

Add documentation for the public API of SlicerWizard.TemplateManager.
Also, fix some code issues revealed in the course of writing the same:

- Add '_' prefix to private helper functions
- Add public setKey() method
- Move adding arguments to TemplateManager, for consistency with
  parseArguments()

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22984 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Move WizardHelpFormatter to its own module

As the class is referenced in the SlicerWizard.TemplateManager
documentation, and as ExtensionWizard is a class module which (as a
module) we want to hide, move WizardHelpFormatter to its own module so
that it is available to external users. Also, add documentation for the
same.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22985 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Remove execute permissions from modules

Remove the +x bits from the SlicerWizard module .py files, as these are
not needed or wanted (and now that the shebangs are removed, the commit
hook doesn't like them).

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22986 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Add documentation generation for SlicerWizard

Add CMake machinery to generate (using sphinx) HTML documentation from
the Python docstrings of SlicerWizard. I've been using this internally
(calling sphinx-build by hand) for a while now, but am committing it now
that it has been tied into CMake. Parts of this are generated from
sphinx-apidoc, but there are also already some enhancements added, e.g.
intersphinx setup, and the overriding of autodoc.ClassDocumenter to
remove the redundant module name from class module classes.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22987 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fix default exit code of Utilities.die

Change the default exit code of SlicerWizard.Utilities.die from 0 to 1.
The former is a poor choice as it means "success", which not usually the
case when calling die().

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22988 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Document and enhance ExtensionWizard.py

Add documentation of SlicerWizard.ExtensionWizard. Tweak create() and
addModule() commands to improve error reporting, and in particular for
addModule() to attempt to do nothing in case of an error (or at least,
to not write changes to the extension's CMakeLists.txt). Add a helper
wrapper around execute() to allow for much greater flexibility, e.g. if
it should cause the application to terminate (and newly do so
consistently) or return an exit code, and to allow CLI arguments to be
passed as method arguments (including gitpython-like kwargs support).

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22989 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Find pull request more strictly

Change how the Extension Wizard looks up pull requests to do the look-up
not against the user that submitted the request, but against the
downstream repository (which should imply the user). I'm not sure if
github even allows a user to have multiple forks of the same upstream
repository, but this will guard against that in case it would ever
happen.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22990 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Confirm changes to extension information

Change how 'extensionwizard.py --publish' modifies the extension
information to prompt the user before making changes to URL's (the
HOMEPAGE in particular, but also the ICONURL) if the existing URL does
not have 'example.com' as the host. As example.com is a reserved name,
such a URL (e.g. the default values from the templates) cannot possible
be valid and so should be safe to change in all cases, but this should
cause us to stop and confirm if we're about to change a URL that the
user has already changed to some potentially valid location (e.g. the
wiki).

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22991 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Refactor and improve SlicerWizard arg parsing

Move conversion of Python method arguments to CLI arguments to its own
helper function in the Utilities module. Tweak this to handle non-string
arguments and to better handle bool and None arguments (note that a
named argument with the value None is now ignored, as is a named
argument with a value False; True is now used for flag options). Also
add support for "short" arguments (assuming a one-character name is
"short"). All this should make the conversion more intuitive and easier
to use.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22992 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Add Python Subversion module

Create a basic module for working with subversion repositories, loosely
based on GitPython. This will help us to work with extensions which use
svn for their source control. (None of the existing svn Python bindings
I tried were useful.)

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22993 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: "Expand" acronyms in documentation

Add a substitution for "CLI" to the SlicerWizard documentation to insert
a sphinx abbreviation where it is used.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22994 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Add svn support to SlicerWizard

Add support for subversion repositories to SlicerWizard. This covers
ExtensionDescription and several methods in Utilities (e.g. getRepo),
and should allow the Extension Wizard 'describe' and 'contribute'
commands to work with svn repositories.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22995 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Degrade gracefully if git unavailable

Modify SlicerWizard to attempt to gracefully degrade functionality if
either of the 'git' or 'github' packages are not available, in order to
make them "soft" rather than "hard" dependencies.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22996 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Document SlicerWizard/TemplateManager.py

Add documentation for the public API of
SlicerWizard.ExtensionDescription. Also, make some minor code
improvements suggested in the course of writing the same:

- Allow clear() to take an optional name of a single attribute to remove
- Accept any object with a callable write() method as a stream in
  write()

Also, because we want to use it here, add a new reST role when
generating the documentation to create links to the Slicer wiki. (This
is useful because (1) it will allow us to later enhance the same to
select the appropriate version's documentation, and (2) the full links
are bloody long; way over our desired 80 character limit.)

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22997 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Improve SlicerWizard doc generation

Pass Slicer version and wiki version into SlicerWizard documentation
generation, and make use of the same. Add 'author' option and use as
required by the various documentation types, rather than each
duplicating the string (which was still set to "Author").

The way we arrange to communicate values into conf.py is a little
esoteric, but it works (and thus saves us from needing to make conf.py a
configured file), and seems to be the only reasonable way to pass
information from the command line to conf.py.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22998 3bd1e089-480b-0410-8dfb-8563597acbee
STYLE: Document SlicerWizard package

Add some (very basic) documentation of the SlicerWizard package. This is
generic documentation of the package itself, different from the already
existing documentation of individual classes and modules within the
package. In particular, add a short note that this is API documentation
and not documentation for users of the Extension Wizard (with a link to
that documentation).

Also, remove mention of "Extension Wizard" in summary documentation of
WizardHelpFormatter, to avoid implying it is only useful for that
purpose.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22999 3bd1e089-480b-0410-8dfb-8563597acbee
ENH: Add version information to SlicerWizard

Add package version information to SlicerWizard, and add display of the
same via the usual '--version' argument to the Extension Wizard. Note
that this is done via a committed file containing the version
information which is duplicated from the top-level CMakeLists.txt. There
is also a CMakeLists.txt now in Utilities/Scripts/SlicerWizard to update
this file, which should keep the contents in sync. Updating the version
should ideally be done by making the changes in the top-level
CMakeLists.txt, configuring, and *then* committing the changes (which
will include as a result the SlicerWizard __version__.py).

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23000 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: Fix extension index push corner case

Fix error pushing a user update branch to the extension index if the
branch name already exists but has not been fetched locally. This can
happen e.g. if an index update request was previously created from a
different clone of the extension index.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23001 3bd1e089-480b-0410-8dfb-8563597acbee