introduce the six module and reduce sphinx.util.pycompat implementation. refs #1350.

This commit is contained in:
Takayuki Shimizukawa
2014-04-29 11:46:47 +09:00
parent 1e4b390b22
commit 68290a266c
38 changed files with 142 additions and 137 deletions

View File

@@ -12,6 +12,8 @@ import sys
import shutil
from codecs import open
import six
FILESYSTEMENCODING = sys.getfilesystemencoding() or sys.getdefaultencoding()
@@ -20,7 +22,7 @@ class path(unicode):
"""
Represents a path which behaves like a string.
"""
if sys.version_info < (3, 0):
if six.PY2:
def __new__(cls, s, encoding=FILESYSTEMENCODING, errors='strict'):
if isinstance(s, str):
s = s.decode(encoding, errors)