diff options
author | Simon Sawicki <contact@grub4k.xyz> | 2023-01-06 18:01:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-06 22:31:18 +0530 |
commit | 5be214abed6d35a5337a806c74a5883a58d6934e (patch) | |
tree | 836b4ad4bde2e8b5c39a427bbba5cbe3c613246f /yt_dlp/update.py | |
parent | d37422f1db3cbdf85638eea42e73883ab1c9df10 (diff) | |
download | hypervideo-pre-5be214abed6d35a5337a806c74a5883a58d6934e.tar.lz hypervideo-pre-5be214abed6d35a5337a806c74a5883a58d6934e.tar.xz hypervideo-pre-5be214abed6d35a5337a806c74a5883a58d6934e.zip |
[update] Fix updater file removal on windows (#5970)
Reverts 2fb0f858686c46abc50a0e253245afe750746775
Closes #5632
Authored by: Grub4K
Diffstat (limited to 'yt_dlp/update.py')
-rw-r--r-- | yt_dlp/update.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/yt_dlp/update.py b/yt_dlp/update.py index a3a731aef..dad273267 100644 --- a/yt_dlp/update.py +++ b/yt_dlp/update.py @@ -15,6 +15,7 @@ from .utils import ( Popen, cached_method, deprecation_warning, + remove_end, shell_quote, system_identifier, traverse_obj, @@ -42,8 +43,7 @@ def _get_variant_and_executable_path(): # Ref: https://en.wikipedia.org/wiki/Uname#Examples if machine[1:] in ('x86', 'x86_64', 'amd64', 'i386', 'i686'): machine = '_x86' if platform.architecture()[0][:2] == '32' else '' - # NB: https://github.com/yt-dlp/yt-dlp/issues/5632 - return f'{sys.platform}{machine}_exe', path + return f'{remove_end(sys.platform, "32")}{machine}_exe', path path = os.path.dirname(__file__) if isinstance(__loader__, zipimporter): @@ -74,8 +74,8 @@ def current_git_head(): _FILE_SUFFIXES = { 'zip': '', 'py2exe': '_min.exe', - 'win32_exe': '.exe', - 'win32_x86_exe': '_x86.exe', + 'win_exe': '.exe', + 'win_x86_exe': '_x86.exe', 'darwin_exe': '_macos', 'darwin_legacy_exe': '_macos_legacy', 'linux_exe': '_linux', @@ -264,7 +264,8 @@ class Updater: self._report_error('Unable to overwrite current version') return os.rename(old_filename, self.filename) - if detect_variant() in ('win32_exe', 'py2exe'): + variant = detect_variant() + if variant.startswith('win') or variant == 'py2exe': atexit.register(Popen, f'ping 127.0.0.1 -n 5 -w 1000 & del /F "{old_filename}"', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) elif old_filename: |