Skip to content

Commit

Permalink
[update] Fix updating via symlinks (closes #23991)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw authored and pareronia committed Jun 22, 2020
1 parent c4a6798 commit 2c5a3a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions youtube_dl/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3009,6 +3009,7 @@ def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
'compat_os_name',
'compat_parse_qs',
'compat_print',
'compat_realpath',
'compat_setenv',
'compat_shlex_quote',
'compat_shlex_split',
Expand Down
5 changes: 4 additions & 1 deletion youtube_dl/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sys
from zipimport import zipimporter

from .compat import compat_realpath
from .utils import encode_compat_str

from .version import __version__
Expand Down Expand Up @@ -84,7 +85,9 @@ def version_tuple(version_str):
print_notes(to_screen, versions_info['versions'])

# sys.executable is set to the full pathname of the exe-file for py2exe
filename = sys.executable if hasattr(sys, 'frozen') else sys.argv[0]
# though symlinks are not followed so that we need to do this manually
# with help of realpath
filename = compat_realpath(sys.executable if hasattr(sys, 'frozen') else sys.argv[0])

if not os.access(filename, os.W_OK):
to_screen('ERROR: no write permissions on %s' % filename)
Expand Down

0 comments on commit 2c5a3a2

Please sign in to comment.