X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/684fbbb940adb6ea4043bc437e527888687a53da..8dad65a5e825b7bf2b2b16eb05114f0192e42ed3:/youtube_dl/compat.py?ds=inline diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py index c75ab13..d1b86bd 100644 --- a/youtube_dl/compat.py +++ b/youtube_dl/compat.py @@ -2754,6 +2754,17 @@ else: 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 @@ -2998,6 +3009,7 @@ __all__ = [ 'compat_os_name', 'compat_parse_qs', 'compat_print', + 'compat_realpath', 'compat_setenv', 'compat_shlex_quote', 'compat_shlex_split',