mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fixed warnings in python3
This commit is contained in:
parent
20a21ed35a
commit
98b6073a7e
@ -80,7 +80,7 @@ class WarningStream(object):
|
|||||||
self.warnfunc = warnfunc
|
self.warnfunc = warnfunc
|
||||||
def write(self, text):
|
def write(self, text):
|
||||||
if text.strip():
|
if text.strip():
|
||||||
self.warnfunc(text, None, '')
|
self.warnfunc(text.strip(), None, '')
|
||||||
|
|
||||||
|
|
||||||
class NoUri(Exception):
|
class NoUri(Exception):
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import htmlentitydefs
|
import htmlentitydefs
|
||||||
|
import sys
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -60,6 +61,10 @@ def tail_check(check):
|
|||||||
return checker
|
return checker
|
||||||
|
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 0):
|
||||||
|
ENV_WARNINGS = remove_unicode_literals(ENV_WARNINGS)
|
||||||
|
HTML_WARNINGS = remove_unicode_literals(HTML_WARNINGS)
|
||||||
|
|
||||||
HTML_XPATH = {
|
HTML_XPATH = {
|
||||||
'images.html': [
|
'images.html': [
|
||||||
(".//img[@src='_images/img.png']", ''),
|
(".//img[@src='_images/img.png']", ''),
|
||||||
|
@ -32,6 +32,9 @@ None:None: WARNING: no matching candidate for image URI u'foo.\\*'
|
|||||||
WARNING: invalid pair index entry u''
|
WARNING: invalid pair index entry u''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 0):
|
||||||
|
LATEX_WARNINGS = remove_unicode_literals(LATEX_WARNINGS)
|
||||||
|
|
||||||
|
|
||||||
@with_app(buildername='latex', warning=latex_warnfile, cleanenv=True)
|
@with_app(buildername='latex', warning=latex_warnfile, cleanenv=True)
|
||||||
def test_latex(app):
|
def test_latex(app):
|
||||||
|
@ -11,6 +11,7 @@ import sys
|
|||||||
import StringIO
|
import StringIO
|
||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
|
import re
|
||||||
from codecs import open
|
from codecs import open
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -32,7 +33,7 @@ __all__ = [
|
|||||||
'raises', 'raises_msg', 'Struct',
|
'raises', 'raises_msg', 'Struct',
|
||||||
'ListOutput', 'TestApp', 'with_app', 'gen_with_app',
|
'ListOutput', 'TestApp', 'with_app', 'gen_with_app',
|
||||||
'path', 'with_tempdir', 'write_file',
|
'path', 'with_tempdir', 'write_file',
|
||||||
'sprint',
|
'sprint', 'remove_unicode_literals',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -206,3 +207,7 @@ def write_file(name, contents, encoding=None):
|
|||||||
|
|
||||||
def sprint(*args):
|
def sprint(*args):
|
||||||
sys.stderr.write(' '.join(map(str, args)) + '\n')
|
sys.stderr.write(' '.join(map(str, args)) + '\n')
|
||||||
|
|
||||||
|
_unicode_literals_re = re.compile(r'u(".*")|u(\'.*\')')
|
||||||
|
def remove_unicode_literals(s):
|
||||||
|
return _unicode_literals_re.sub(lambda x: x.group(1) or x.group(2), s)
|
||||||
|
Loading…
Reference in New Issue
Block a user