mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Move the "b" function to pycompat.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user