aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/update.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-06-01 03:32:09 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-06-01 03:32:09 +0530
commit4040428efceb0aad9848eb75fc56c79caddcbb3d (patch)
tree1aa3bdac802ff513902cd51adfa9de30798c465b /yt_dlp/update.py
parentcc1dfc93739fc28a2af1ce906b450e5cc1c3ae62 (diff)
downloadhypervideo-pre-4040428efceb0aad9848eb75fc56c79caddcbb3d.tar.lz
hypervideo-pre-4040428efceb0aad9848eb75fc56c79caddcbb3d.tar.xz
hypervideo-pre-4040428efceb0aad9848eb75fc56c79caddcbb3d.zip
[update] Block further update for unsupported systems
Diffstat (limited to 'yt_dlp/update.py')
-rw-r--r--yt_dlp/update.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/yt_dlp/update.py b/yt_dlp/update.py
index 055e33f1e..14ae96633 100644
--- a/yt_dlp/update.py
+++ b/yt_dlp/update.py
@@ -87,10 +87,19 @@ def run_update(ydl):
h.update(mv[:n])
return h.hexdigest()
- if not isinstance(globals().get('__loader__'), zipimporter) and not hasattr(sys, 'frozen'):
- return report_error(
- 'It looks like you installed yt-dlp with a package manager, pip, setup.py or a tarball. '
- 'Please use that to update', expected=True)
+ err = None
+ if isinstance(globals().get('__loader__'), zipimporter):
+ # We only support python 3.6 or above
+ if sys.version_info < (3, 6):
+ err = 'This is the last release of yt-dlp for Python version %d.%d! Please update to Python 3.6 or above' % sys.version_info[:2]
+ elif hasattr(sys, 'frozen'):
+ # Python 3.6 supports only vista and above
+ if sys.getwindowsversion()[0] < 6:
+ err = 'This is the last release of yt-dlp for your version of Windows. Please update to Windows Vista or above'
+ else:
+ err = 'It looks like you installed yt-dlp with a package manager, pip, setup.py or a tarball. Please use that to update'
+ if err:
+ return report_error(err, expected=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
@@ -117,7 +126,6 @@ def run_update(ydl):
version_labels = {
'zip_3': '',
- 'zip_2': '',
'exe_64': '.exe',
'exe_32': '_x86.exe',
}
@@ -202,8 +210,7 @@ def run_update(ydl):
# Zip unix package
elif isinstance(globals().get('__loader__'), zipimporter):
try:
- py_ver = platform.python_version()[0]
- url = get_bin_info('zip', py_ver).get('browser_download_url')
+ url = get_bin_info('zip', '3').get('browser_download_url')
if not url:
return report_error('unable to fetch updates', True)
urlh = ydl._opener.open(url)
@@ -212,7 +219,7 @@ def run_update(ydl):
except (IOError, OSError, StopIteration):
return report_error('unable to download latest version', True)
- expected_sum = get_sha256sum('zip', py_ver)
+ expected_sum = get_sha256sum('zip', '3')
if expected_sum and hashlib.sha256(newcontent).hexdigest() != expected_sum:
return report_error('unable to verify the new zip', True)