merge with 0.6

This commit is contained in:
Georg Brandl 2009-06-15 17:33:56 +02:00
commit 7d56682ad7
5 changed files with 31 additions and 7 deletions

View File

@ -28,6 +28,9 @@ Release 1.0 (in development)
Release 0.6.2 (in development)
==============================
* #196: Add a warning if an extension module doesn't have a
``setup()`` function.
* #158: Allow '..' in template names, and absolute template paths;
Jinja 2 by default disables both.

View File

@ -23,8 +23,8 @@ This section is intended to collect helpful hints for those wanting to migrate
to reStructuredText/Sphinx from other documentation systems.
* Gerard Flanagan has written a script to convert pure HTML to reST; it can be
found at `Launchpad
<http://bazaar.launchpad.net/~grflanagan/python-rattlebag/trunk/annotate/head:/src/html2rest.py>`_.
found at `BitBucket
<http://bitbucket.org/djerdo/musette/src/tip/musette/html/html2rest.py>`_.
* For converting the old Python docs to Sphinx, a converter was written which
can be found at `the Python SVN repository

View File

@ -167,7 +167,10 @@ class Sphinx(object):
except ImportError, err:
raise ExtensionError('Could not import extension %s' % extension,
err)
if hasattr(mod, 'setup'):
if not hasattr(mod, 'setup'):
self.warn('extension %r has no setup() function; is it really '
'a Sphinx extension module?' % extension)
else:
mod.setup(self)
self._extensions[extension] = mod

View File

@ -509,8 +509,12 @@ class StandaloneHTMLBuilder(Builder):
ensuredir(path.join(self.outdir, '_images'))
for src, dest in self.images.iteritems():
self.info(' '+src, nonl=1)
copyfile(path.join(self.srcdir, src),
path.join(self.outdir, '_images', dest))
try:
copyfile(path.join(self.srcdir, src),
path.join(self.outdir, '_images', dest))
except Exception, err:
self.warn('cannot copy image file %r: %s' %
(path.join(self.srcdir, src), err))
self.info()
# copy downloadable files
@ -519,8 +523,12 @@ class StandaloneHTMLBuilder(Builder):
ensuredir(path.join(self.outdir, '_downloads'))
for src, (_, dest) in self.env.dlfiles.iteritems():
self.info(' '+src, nonl=1)
copyfile(path.join(self.srcdir, src),
path.join(self.outdir, '_downloads', dest))
try:
copyfile(path.join(self.srcdir, src),
path.join(self.outdir, '_downloads', dest))
except Exception, err:
self.warn('cannot copy downloadable file %r: %s' %
(path.join(self.srcdir, src), err))
self.info()
# copy static files

View File

@ -57,3 +57,13 @@ def test_output():
assert app._warncount == old_count + 1
finally:
app.cleanup()
def test_extensions():
status, warnings = StringIO(), StringIO()
app = TestApp(status=status, warning=warnings)
try:
app.setup_extension('shutil')
assert warnings.getvalue().startswith("WARNING: extension 'shutil'")
finally:
app.cleanup()