Move the "b" function to pycompat.

This commit is contained in:
Georg Brandl
2010-07-28 18:43:40 +02:00
parent 24f1d4c12d
commit ec5a5e739b
3 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -11,10 +11,10 @@
import os
import re
import sys
import time
import errno
import shutil
import sys
from os import path
# Errnos that we need.
+8
View File
@@ -26,6 +26,14 @@ except NameError:
base_exception = Exception
# the ubiquitous "bytes" helper function
if sys.version_info > (3, 0):
def b(s):
return s.encode('utf-8')
else:
b = str
try:
any = any
all = all
+1 -7
View File
@@ -10,7 +10,6 @@
"""
import re
import sys
from util import *
@@ -18,15 +17,10 @@ from docutils import frontend, utils, nodes
from docutils.parsers import rst
from sphinx.util import texescape
from sphinx.util.pycompat import b
from sphinx.writers.html import HTMLWriter, SmartyPantsHTMLTranslator
from sphinx.writers.latex import LaTeXWriter, LaTeXTranslator
if sys.version_info > (3, 0):
def b(s):
return s.encode('utf-8')
else:
b = str
def setup_module():
global app, settings, parser
texescape.init() # otherwise done by the latex builder