from zipimport import zipimporter
from .compat import compat_realpath
-from .utils import encode_compat_str, Popen
+from .utils import encode_compat_str, Popen, write_string
from .version import __version__
'win_dir': 'Auto-update is not supported for unpackaged windows executable; Re-download the latest release',
'mac_dir': 'Auto-update is not supported for unpackaged MacOS executable; Re-download the latest release',
'source': 'You cannot update when running from source code; Use git to pull the latest changes',
- 'unknown': 'It looks like you installed yt-dlp with a package manager, pip, setup.py or a tarball; Use that to update',
+ 'unknown': 'It looks like you installed yt-dlp with a package manager, pip or setup.py; Use that to update',
}
return tuple(map(int, version_str.split('.')))
version_id = version_info['tag_name']
+ ydl.to_screen(f'Latest version: {version_id}, Current version: {__version__}')
if version_tuple(__version__) >= version_tuple(version_id):
ydl.to_screen(f'yt-dlp is up to date ({__version__})')
return
err = is_non_updateable()
if err:
- ydl.to_screen(f'Latest version: {version_id}, Current version: {__version__}')
return report_error(err, True)
# sys.executable is set to the full pathname of the exe-file for py2exe
# 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])
- ydl.to_screen(f'Current version {__version__}; Build Hash {calc_sha256sum(filename)}')
+ ydl.to_screen(f'Current Build Hash {calc_sha256sum(filename)}')
ydl.to_screen(f'Updating to version {version_id} ...')
version_labels = {
'''
+# Deprecated
def update_self(to_screen, verbose, opener):
- ''' Exists for backward compatibility '''
printfn = to_screen
- printfn(
- 'WARNING: "yt_dlp.update.update_self" is deprecated and may be removed in a future version. '
- 'Use "yt_dlp.update.run_update(ydl)" instead')
+ write_string(
+ 'DeprecationWarning: "yt_dlp.update.update_self" is deprecated and may be removed in a future version. '
+ 'Use "yt_dlp.update.run_update(ydl)" instead\n')
class FakeYDL():
_opener = opener