3535 # Python 3
3636 unicode = str
3737
38+ try :
39+ from os import fsencode
40+ except ImportError :
41+ from backports .os import fsencode
42+ from backports .os import fsdecode
43+
44+
3845import codecs
3946import errno
4047import os
4552import sys
4653import tempfile
4754
48- from backports import os as osb
4955
5056from commoncode import filetype
5157from commoncode .filetype import is_rwx
@@ -77,10 +83,6 @@ def logger_debug(*args):
7783 return logger .debug (' ' .join (isinstance (a , basestring ) and a or repr (a ) for a in args ))
7884
7985
80- FS_ENCODING = sys .getfilesystemencoding ()
81- # normalize the encoding name
82- FS_ENCODING = codecs .lookup (FS_ENCODING ).name
83-
8486# Paths can only be sanely handled as raw bytes on Linux
8587PATH_TYPE = bytes if on_linux else unicode
8688POSIX_PATH_SEP = b'/' if on_linux else '/'
@@ -219,8 +221,8 @@ def path_to_unicode(path):
219221 """
220222 if isinstance (path , unicode ):
221223 return path
222- if TRACE : logger_debug ('path_to_unicode:' , osb . fsdecode (path ))
223- return osb . fsdecode (path )
224+ if TRACE : logger_debug ('path_to_unicode:' , fsdecode (path ))
225+ return fsdecode (path )
224226
225227
226228def path_to_bytes (path ):
@@ -229,8 +231,8 @@ def path_to_bytes(path):
229231 """
230232 if isinstance (path , bytes ):
231233 return path
232- if TRACE : logger_debug ('path_to_bytes:' , repr (osb . fsencode (path )))
233- return osb . fsencode (path )
234+ if TRACE : logger_debug ('path_to_bytes:' , repr (fsencode (path )))
235+ return fsencode (path )
234236
235237
236238def is_posixpath (location ):
0 commit comments