make all syntax compatible with 3.1 and 2.5
--HG-- branch : trunk
This commit is contained in:
@@ -50,7 +50,7 @@ def convert_dot(fn, new_extension):
|
||||
if not py.path.local.sysfind("dot"):
|
||||
raise SystemExit("ERROR: dot not found")
|
||||
result = fn.new(ext=new_extension)
|
||||
print result
|
||||
print(result)
|
||||
arg = "-T%s" % (format_to_dotargument[new_extension], )
|
||||
py.std.os.system('dot "%s" "%s" > "%s"' % (arg, fn, result))
|
||||
if new_extension == "eps":
|
||||
|
||||
@@ -26,7 +26,7 @@ else:
|
||||
class ImageClass(object):
|
||||
option_spec = images.image.options
|
||||
def run(self):
|
||||
return images.image(u'image',
|
||||
return images.image('image',
|
||||
self.arguments,
|
||||
self.options,
|
||||
self.content,
|
||||
@@ -51,7 +51,7 @@ class GraphvizDirective(ImageClass):
|
||||
self.state.document.settings._source)
|
||||
text = self.block_text.replace("graphviz", "image", 1)
|
||||
self.block_text = text.replace(self.arguments[0], newname, 1)
|
||||
self.name = u'image'
|
||||
self.name = 'image'
|
||||
self.arguments = [newname]
|
||||
return ImageClass.run(self)
|
||||
|
||||
|
||||
@@ -132,15 +132,16 @@ def process_rest_file(restfile, stylesheet=None, debug=False, rest_options=None)
|
||||
while i < 10: # there should never be as many as five reruns, but to be sure
|
||||
try:
|
||||
latexoutput = py.process.cmdexec('pdflatex "%s"' % (tex, ))
|
||||
except ExecutionFailed, e:
|
||||
print "ERROR: pdflatex execution failed"
|
||||
print "pdflatex stdout:"
|
||||
print e.out
|
||||
print "pdflatex stderr:"
|
||||
print e.err
|
||||
except ExecutionFailed:
|
||||
e = py.std.sys.exc_info()[1]
|
||||
print("ERROR: pdflatex execution failed")
|
||||
print("pdflatex stdout:")
|
||||
print(e.out)
|
||||
print("pdflatex stderr:")
|
||||
print(e.err)
|
||||
raise SystemExit
|
||||
if debug:
|
||||
print latexoutput
|
||||
print(latexoutput)
|
||||
if py.std.re.search("LaTeX Warning:.*Rerun", latexoutput) is None:
|
||||
break
|
||||
i += 1
|
||||
|
||||
@@ -4,7 +4,7 @@ import re
|
||||
|
||||
if hasattr(sys.stdout, 'fileno') and os.isatty(sys.stdout.fileno()):
|
||||
def log(msg):
|
||||
print msg
|
||||
print(msg)
|
||||
else:
|
||||
def log(msg):
|
||||
pass
|
||||
@@ -59,8 +59,14 @@ def process(txtpath, encoding='latin1'):
|
||||
# info = txtpath.info()
|
||||
# svninfopath.dump(info)
|
||||
|
||||
rex1 = re.compile(ur'.*<body>(.*)</body>.*', re.MULTILINE | re.DOTALL)
|
||||
rex2 = re.compile(ur'.*<div class="document">(.*)</div>.*', re.MULTILINE | re.DOTALL)
|
||||
if sys.version_info > (3, 0):
|
||||
def _uni(s): return s
|
||||
else:
|
||||
def _uni(s):
|
||||
return unicode(s)
|
||||
|
||||
rex1 = re.compile(r'.*<body>(.*)</body>.*', re.MULTILINE | re.DOTALL)
|
||||
rex2 = re.compile(r'.*<div class="document">(.*)</div>.*', re.MULTILINE | re.DOTALL)
|
||||
|
||||
def strip_html_header(string, encoding='utf8'):
|
||||
""" return the content of the body-tag """
|
||||
|
||||
@@ -128,8 +128,8 @@ class Rest(AbstractNode):
|
||||
outcome = []
|
||||
if (isinstance(self.children[0], Transition) or
|
||||
isinstance(self.children[-1], Transition)):
|
||||
raise ValueError, ('document must not begin or end with a '
|
||||
'transition')
|
||||
raise ValueError('document must not begin or end with a '
|
||||
'transition')
|
||||
for child in self.children:
|
||||
outcome.append(child.text())
|
||||
|
||||
|
||||
@@ -149,8 +149,8 @@ turpis. Etiam et ipsum. Quisque at lacus. Etiam pellentesque, enim porta
|
||||
pulvinar viverra, libero elit iaculis justo, vitae convallis pede purus vel
|
||||
arcu. Morbi aliquam lacus et urna. Donec commodo pellentesque mi."""
|
||||
txt = Paragraph(text, width=80).text()
|
||||
print repr(txt)
|
||||
print repr(expected)
|
||||
print(repr(txt))
|
||||
print(repr(expected))
|
||||
assert txt == expected
|
||||
checkrest(txt)
|
||||
|
||||
@@ -172,7 +172,7 @@ Paragraph
|
||||
"""
|
||||
txt = Rest(Paragraph("Text"), LiteralBlock("def fun():\n some"), \
|
||||
Paragraph("Paragraph")).text()
|
||||
print repr(txt)
|
||||
print(repr(txt))
|
||||
assert txt == expected
|
||||
checkrest(txt)
|
||||
|
||||
@@ -183,7 +183,7 @@ Foo
|
||||
Bar
|
||||
"""
|
||||
txt = Rest(Paragraph('Foo'), LiteralBlock(''), Paragraph('Bar')).text()
|
||||
print repr(txt)
|
||||
print(repr(txt))
|
||||
assert txt == expected
|
||||
checkrest(txt)
|
||||
|
||||
@@ -359,7 +359,7 @@ def test_nested_nested_lists():
|
||||
"""
|
||||
txt = Rest(ListItem('foo', ListItem('bar', ListItem('baz')),
|
||||
ListItem('qux')), ListItem('quux')).text()
|
||||
print txt
|
||||
print(txt)
|
||||
assert txt == expected
|
||||
checkrest(txt)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user