]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/update.py
[youtube:tab] Add `approximate_date` extractor-arg
[yt-dlp.git] / yt_dlp / update.py
index 9fadae90c517eefc7e460fe128f86b19af20182a..a208e163c9d41b72dfa6a8ca94a2cc5893b16057 100644 (file)
@@ -10,7 +10,7 @@
 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__
 
@@ -54,7 +54,7 @@ def detect_variant():
     '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',
 }
 
 
@@ -102,20 +102,20 @@ def version_tuple(version_str):
         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 = {
@@ -250,14 +250,14 @@ def print_notes(to_screen, versions, fromVersion=__version__):
 '''
 
 
+# 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