projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fffc618
)
[compat] Introduce compat_realpath (refs #23991)
author
Sergey M․
<dstftw@gmail.com>
Sat, 8 Feb 2020 12:36:55 +0000
(19:36 +0700)
committer
Sergey M․
<dstftw@gmail.com>
Sat, 8 Feb 2020 12:36:55 +0000
(19:36 +0700)
youtube_dl/compat.py
patch
|
blob
|
history
diff --git
a/youtube_dl/compat.py
b/youtube_dl/compat.py
index c75ab131b9955cec1367ec42aa41d8dadde423da..062b338d73d839c79c496c0103a42da6bac044f1 100644
(file)
--- a/
youtube_dl/compat.py
+++ b/
youtube_dl/compat.py
@@
-2754,6
+2754,17
@@
else:
compat_expanduser = os.path.expanduser
compat_expanduser = os.path.expanduser
+if compat_os_name == 'nt' and sys.version_info < (3, 8):
+ # os.path.realpath on Windows does not follow symbolic links
+ # prior to Python 3.8 (see https://bugs.python.org/issue9949)
+ def compat_realpath(path):
+ while os.path.islink(path):
+ path = os.path.abspath(os.readlink(path))
+ return path
+else:
+ compat_realpath = os.path.realpath
+
+
if sys.version_info < (3, 0):
def compat_print(s):
from .utils import preferredencoding
if sys.version_info < (3, 0):
def compat_print(s):
from .utils import preferredencoding