summaryrefslogtreecommitdiff
path: root/sphinx/setup_command.py
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2014-01-19 14:17:10 +0400
committerDmitry Shachnev <mitya57@gmail.com>2014-01-19 14:17:10 +0400
commitce2185ce279664e54ba22b14663091abc5a3a8f2 (patch)
tree97b00b55be0e28a73399acc0f80e21e6a4e24b28 /sphinx/setup_command.py
parentfa9695dbe0b090eb9907647b7a8d1c20210efa5b (diff)
downloadsphinx-git-ce2185ce279664e54ba22b14663091abc5a3a8f2.tar.gz
Modernize the code now that Python 2.5 is no longer supported
- Use print function instead of print statement; - Use new exception handling; - Use in operator instead of has_key(); - Do not use tuple arguments in functions; - Other miscellaneous improvements. This is based on output of `futurize --stage1`, with some manual corrections.
Diffstat (limited to 'sphinx/setup_command.py')
-rw-r--r--sphinx/setup_command.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/sphinx/setup_command.py b/sphinx/setup_command.py
index 07cd520c3..25198ee60 100644
--- a/sphinx/setup_command.py
+++ b/sphinx/setup_command.py
@@ -11,6 +11,7 @@
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
+from __future__ import print_function
import sys
import os
@@ -144,12 +145,12 @@ class BuildDoc(Command):
try:
app.build(force_all=self.all_files)
- except Exception, err:
+ except Exception as err:
from docutils.utils import SystemMessage
if isinstance(err, SystemMessage):
- print >>sys.stderr, darkred('reST markup error:')
- print >>sys.stderr, err.args[0].encode('ascii',
- 'backslashreplace')
+ print(darkred('reST markup error:'), file=sys.stderr)
+ print(err.args[0].encode('ascii',
+ 'backslashreplace'), file=sys.stderr)
else:
raise