nt._getfinalpathname is now always available
This commit is contained in:
parent
f1d4c8aa23
commit
d20ab7b4f2
|
@ -13,14 +13,9 @@ from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO
|
|||
from urllib.parse import quote_from_bytes as urlquote_from_bytes
|
||||
|
||||
|
||||
supports_symlinks = True
|
||||
if os.name == 'nt':
|
||||
import nt
|
||||
if sys.getwindowsversion()[:2] >= (6, 0):
|
||||
from nt import _getfinalpathname
|
||||
else:
|
||||
supports_symlinks = False
|
||||
_getfinalpathname = None
|
||||
from nt import _getfinalpathname
|
||||
else:
|
||||
nt = None
|
||||
|
||||
|
@ -194,8 +189,6 @@ class _WindowsFlavour(_Flavour):
|
|||
s = str(path)
|
||||
if not s:
|
||||
return os.getcwd()
|
||||
if _getfinalpathname is None:
|
||||
return None # Means fallback on absolute
|
||||
if strict:
|
||||
return self._ext_to_normal(_getfinalpathname(s))
|
||||
s = path = os.path.abspath(s)
|
||||
|
@ -429,11 +422,7 @@ class _NormalAccessor(_Accessor):
|
|||
replace = os.replace
|
||||
|
||||
if nt:
|
||||
if supports_symlinks:
|
||||
symlink = os.symlink
|
||||
else:
|
||||
def symlink(a, b, target_is_directory):
|
||||
raise NotImplementedError("symlink() not available on this system")
|
||||
symlink = os.symlink
|
||||
else:
|
||||
# Under POSIX, os.symlink() takes two args
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue