]> jfr.im git - yt-dlp.git/commitdiff
[update] Fix current build hash for UNIX
authorpukkandan <redacted>
Wed, 3 Mar 2021 13:24:30 +0000 (18:54 +0530)
committerpukkandan <redacted>
Wed, 3 Mar 2021 13:32:21 +0000 (19:02 +0530)
yt_dlp/update.py

index 81c9013a1982292026e99ec7af1aaf4cbba1299c..5ae4e52049046801264de563c5584bd8d441b138 100644 (file)
@@ -49,12 +49,16 @@ def calc_sha256sum(path):
                 h.update(mv[:n])
         return h.hexdigest()
 
-    to_screen('Current Build Hash %s' % calc_sha256sum(sys.executable))
-
     if not isinstance(globals().get('__loader__'), zipimporter) and not hasattr(sys, 'frozen'):
         to_screen('It looks like you installed yt-dlp with a package manager, pip, setup.py or a tarball. Please use that to update.')
         return
 
+    # 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])
+    to_screen('Current Build Hash %s' % calc_sha256sum(filename))
+
     # Download and check versions info
     try:
         version_info = opener.open(JSON_URL).read().decode('utf-8')
@@ -103,11 +107,6 @@ def get_sha256sum(bin_or_exe, version):
             (i[1] for i in hashes if i[0] == 'yt-dlp%s' % label),
             None)
 
-    # 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])
-
     if not os.access(filename, os.W_OK):
         to_screen('ERROR: no write permissions on %s' % filename)
         return