diff options
author | Dmitry Shachnev <mitya57@gmail.com> | 2014-01-20 18:32:47 +0400 |
---|---|---|
committer | Dmitry Shachnev <mitya57@gmail.com> | 2014-01-20 18:32:47 +0400 |
commit | c7539932b582ce7f849d6a83de296426393594d6 (patch) | |
tree | bb18c53d431f98cb3a33df663efe9093af0775ea /sphinx/builders | |
parent | f3ff3c037b4a78fbadf528e4e86b455400b1361c (diff) | |
parent | 344417db950d6e816ab2efb21737c2bdf9d1ad53 (diff) | |
download | sphinx-c7539932b582ce7f849d6a83de296426393594d6.tar.gz |
Merge
Diffstat (limited to 'sphinx/builders')
-rw-r--r-- | sphinx/builders/devhelp.py | 2 | ||||
-rw-r--r-- | sphinx/builders/epub.py | 8 | ||||
-rw-r--r-- | sphinx/builders/gettext.py | 2 | ||||
-rw-r--r-- | sphinx/builders/html.py | 6 | ||||
-rw-r--r-- | sphinx/builders/htmlhelp.py | 9 | ||||
-rw-r--r-- | sphinx/builders/linkcheck.py | 4 | ||||
-rw-r--r-- | sphinx/builders/qthelp.py | 2 | ||||
-rw-r--r-- | sphinx/builders/texinfo.py | 2 | ||||
-rw-r--r-- | sphinx/builders/text.py | 2 | ||||
-rw-r--r-- | sphinx/builders/xml.py | 2 |
10 files changed, 20 insertions, 19 deletions
diff --git a/sphinx/builders/devhelp.py b/sphinx/builders/devhelp.py index 81d2e6ce..4595c7c2 100644 --- a/sphinx/builders/devhelp.py +++ b/sphinx/builders/devhelp.py @@ -94,7 +94,7 @@ class DevhelpBuilder(StandaloneHTMLBuilder): def istoctree(node): return isinstance(node, addnodes.compact_paragraph) and \ - node.has_key('toctree') + 'toctree' in node for node in tocdoc.traverse(istoctree): write_toc(node, chapters) diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py index 35061b79..ad586165 100644 --- a/sphinx/builders/epub.py +++ b/sphinx/builders/epub.py @@ -218,7 +218,7 @@ class EpubBuilder(StandaloneHTMLBuilder): """Collect section titles, their depth in the toc and the refuri.""" # XXX: is there a better way than checking the attribute # toctree-l[1-8] on the parent node? - if isinstance(doctree, nodes.reference) and doctree.has_key('refuri'): + if isinstance(doctree, nodes.reference) and 'refuri' in doctree: refuri = doctree['refuri'] if refuri.startswith('http://') or refuri.startswith('https://') \ or refuri.startswith('irc:') or refuri.startswith('mailto:'): @@ -417,7 +417,7 @@ class EpubBuilder(StandaloneHTMLBuilder): try: copyfile(path.join(self.srcdir, src), path.join(self.outdir, '_images', dest)) - except (IOError, OSError), err: + except (IOError, OSError) as err: self.warn('cannot copy image file %r: %s' % (path.join(self.srcdir, src), err)) continue @@ -433,7 +433,7 @@ class EpubBuilder(StandaloneHTMLBuilder): img = img.resize((nw, nh), Image.BICUBIC) try: img.save(path.join(self.outdir, '_images', dest)) - except (IOError, OSError), err: + except (IOError, OSError) as err: self.warn('cannot write image file %r: %s' % (path.join(self.srcdir, src), err)) @@ -489,7 +489,7 @@ class EpubBuilder(StandaloneHTMLBuilder): fn = path.join(outdir, outname) try: os.mkdir(path.dirname(fn)) - except OSError, err: + except OSError as err: if err.errno != EEXIST: raise f = codecs.open(path.join(outdir, outname), 'w', 'utf-8') diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py index f648c311..f11ac293 100644 --- a/sphinx/builders/gettext.py +++ b/sphinx/builders/gettext.py @@ -184,7 +184,7 @@ class MessageCatalogBuilder(I18nBuilder): for textdomain, catalog in self.status_iterator( self.catalogs.iteritems(), "writing message catalogs... ", darkgreen, len(self.catalogs), - lambda (textdomain, _): textdomain): + lambda textdomain__: textdomain__[0]): # noop if config.gettext_compact is set ensuredir(path.join(self.outdir, path.dirname(textdomain))) diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index d715607e..b5ca56bd 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -531,7 +531,7 @@ class StandaloneHTMLBuilder(Builder): try: copyfile(path.join(self.srcdir, src), path.join(self.outdir, '_images', dest)) - except Exception, err: + except Exception as err: self.warn('cannot copy image file %r: %s' % (path.join(self.srcdir, src), err)) @@ -546,7 +546,7 @@ class StandaloneHTMLBuilder(Builder): try: copyfile(path.join(self.srcdir, src), path.join(self.outdir, '_downloads', dest)) - except Exception, err: + except Exception as err: self.warn('cannot copy downloadable file %r: %s' % (path.join(self.srcdir, src), err)) @@ -773,7 +773,7 @@ class StandaloneHTMLBuilder(Builder): f.write(output) finally: f.close() - except (IOError, OSError), err: + except (IOError, OSError) as err: self.warn("error writing file %s: %s" % (outfilename, err)) if self.copysource and ctx.get('sourcename'): # copy the source file for the "show source" link diff --git a/sphinx/builders/htmlhelp.py b/sphinx/builders/htmlhelp.py index e1723ba0..e7fa4bde 100644 --- a/sphinx/builders/htmlhelp.py +++ b/sphinx/builders/htmlhelp.py @@ -9,6 +9,7 @@ :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ +from __future__ import print_function import os import codecs @@ -197,7 +198,7 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): f = self.open_file(outdir, outname+'.stp') try: for word in sorted(stopwords): - print >>f, word + print(word, file=f) finally: f.close() @@ -217,8 +218,8 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): for fn in files: if (staticdir and not fn.endswith('.js')) or \ fn.endswith('.html'): - print >>f, path.join(root, fn)[olen:].replace(os.sep, - '\\') + print(path.join(root, fn)[olen:].replace(os.sep, '\\'), + file=f) finally: f.close() @@ -256,7 +257,7 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): write_toc(subnode, ullevel) def istoctree(node): return isinstance(node, addnodes.compact_paragraph) and \ - node.has_key('toctree') + 'toctree' in node for node in tocdoc.traverse(istoctree): write_toc(node) f.write(contents_footer) diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 171e68d5..88149ed0 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -153,7 +153,7 @@ class CheckExternalLinksBuilder(Builder): req = HeadRequest(req_url) f = opener.open(req, **kwargs) f.close() - except HTTPError, err: + except HTTPError as err: if err.code != 405: raise # retry with GET if that fails, some servers @@ -162,7 +162,7 @@ class CheckExternalLinksBuilder(Builder): f = opener.open(req, **kwargs) f.close() - except Exception, err: + except Exception as err: self.broken[uri] = str(err) return 'broken', str(err), 0 if f.url.rstrip('/') == req_url.rstrip('/'): diff --git a/sphinx/builders/qthelp.py b/sphinx/builders/qthelp.py index ce07315d..9ef480df 100644 --- a/sphinx/builders/qthelp.py +++ b/sphinx/builders/qthelp.py @@ -123,7 +123,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder): prune_toctrees=False) istoctree = lambda node: ( isinstance(node, addnodes.compact_paragraph) - and node.has_key('toctree')) + and 'toctree' in node) sections = [] for node in tocdoc.traverse(istoctree): sections.extend(self.write_toc(node)) diff --git a/sphinx/builders/texinfo.py b/sphinx/builders/texinfo.py index 9510c150..40ead11a 100644 --- a/sphinx/builders/texinfo.py +++ b/sphinx/builders/texinfo.py @@ -223,6 +223,6 @@ class TexinfoBuilder(Builder): mkfile.write(TEXINFO_MAKEFILE) finally: mkfile.close() - except (IOError, OSError), err: + except (IOError, OSError) as err: self.warn("error writing file %s: %s" % (fn, err)) self.info(' done') diff --git a/sphinx/builders/text.py b/sphinx/builders/text.py index f09ad654..b0704def 100644 --- a/sphinx/builders/text.py +++ b/sphinx/builders/text.py @@ -65,7 +65,7 @@ class TextBuilder(Builder): f.write(self.writer.output) finally: f.close() - except (IOError, OSError), err: + except (IOError, OSError) as err: self.warn("error writing file %s: %s" % (outfilename, err)) def finish(self): diff --git a/sphinx/builders/xml.py b/sphinx/builders/xml.py index 19147fb1..8bc447b1 100644 --- a/sphinx/builders/xml.py +++ b/sphinx/builders/xml.py @@ -81,7 +81,7 @@ class XMLBuilder(Builder): f.write(self.writer.output) finally: f.close() - except (IOError, OSError), err: + except (IOError, OSError) as err: self.warn("error writing file %s: %s" % (outfilename, err)) def finish(self): |