Improve build/updater

* Fix `get_executable_path` in UNIX
* Update `x86.exe` correctly
* Exit immediately in windows once the update process starts so that the file handle is released correctly
* Show `exe`/`zip`/`source` and 32/64bit in verbose message
* Look for both `yt-dlp` and `youtube-dlc` in releases. This ensures that the updater will keep working when the binary name is changed to yt-dlp
* Disable pycryptodome in win_x86 since it causes `distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 10.0 is required`
This commit is contained in:
pukkandan
2021-02-14 22:40:54 +05:30
parent 273762c8d0
commit e5813e53f0
6 changed files with 52 additions and 29 deletions

View File

@@ -549,16 +549,22 @@ def _real_main(argv=None):
}
with YoutubeDL(ydl_opts) as ydl:
# Update version
if opts.update_self:
update_self(ydl.to_screen, opts.verbose, ydl._opener)
actual_use = len(all_urls) or opts.load_info_filename
# Remove cache dir
if opts.rm_cachedir:
ydl.cache.remove()
# Update version
if opts.update_self:
# If updater returns True, exit. Required for windows
if update_self(ydl.to_screen, opts.verbose, ydl._opener):
if actual_use:
parser.error('The program must exit for the update to complete')
sys.exit()
# Maybe do nothing
if (len(all_urls) < 1) and (opts.load_info_filename is None):
if not actual_use:
if opts.update_self or opts.rm_cachedir:
sys.exit()