[update] Prepare to remove Python 3.6 support

This commit is contained in:
pukkandan 2022-07-17 17:36:15 +05:30
parent f5e438a976
commit 24093d52a7
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39
2 changed files with 17 additions and 9 deletions

View File

@ -589,7 +589,7 @@ class YoutubeDL:
if current_version < MIN_RECOMMENDED:
msg = ('Support for Python version %d.%d has been deprecated. '
'See https://github.com/yt-dlp/yt-dlp/issues/3764 for more details.'
'You will recieve only one more update on this version')
'\n You will no longer recieve updates on this version')
if current_version < MIN_SUPPORTED:
msg = 'Python version %d.%d is no longer supported'
self.deprecation_warning(

View File

@ -88,8 +88,7 @@ class Updater:
@functools.cached_property
def _tag(self):
latest = self._get_version_info('latest')['tag_name']
if version_tuple(__version__) >= version_tuple(latest):
if version_tuple(__version__) >= version_tuple(self.latest_version):
return 'latest'
identifier = f'{detect_variant()} {system_identifier()}'
@ -113,9 +112,16 @@ class Updater:
@property
def new_version(self):
"""Version of the latest release"""
"""Version of the latest release we can update to"""
if self._tag.startswith('tags/'):
return self._tag[5:]
return self._get_version_info(self._tag)['tag_name']
@property
def latest_version(self):
"""Version of the latest release"""
return self._get_version_info('latest')['tag_name']
@property
def has_update(self):
"""Whether there is an update available"""
@ -161,13 +167,15 @@ class Updater:
"""Report whether there is an update available"""
try:
self.ydl.to_screen(
f'Latest version: {self.new_version}, Current version: {self.current_version}')
f'Latest version: {self.latest_version}, Current version: {self.current_version}')
if not self.has_update:
if self._tag == 'latest':
return self.ydl.to_screen(f'yt-dlp is up to date ({__version__})')
return self.ydl.report_warning(
'yt-dlp cannot be updated any further since you are on an older Python version')
except Exception:
return self._report_network_error('obtain version info', delim='; Please try again later or')
if not self.has_update:
return self.ydl.to_screen(f'yt-dlp is up to date ({__version__})')
if not is_non_updateable():
self.ydl.to_screen(f'Current Build Hash {_sha256_file(self.filename)}')
return True