]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[update] Check if version from repository is newer before updating
authorPhilipp Hagemeister <phihag@phihag.de>
Fri, 22 Nov 2013 22:05:56 +0000 (23:05 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Fri, 22 Nov 2013 22:05:58 +0000 (23:05 +0100)
Closes #1704

youtube_dl/update.py

index e5f441707c10b76f1f84c07454a71d6aa4cd030d..be7800e8b1a4a149ce63c75e804e8a1d21abbec6 100644 (file)
@@ -41,6 +41,7 @@ def rsa_verify(message, signature, key):
     if signature != sha256(message).digest(): return False
     return True
 
+
 def update_self(to_screen, verbose):
     """Update the program file with the latest version from the repository"""
 
@@ -82,6 +83,13 @@ def update_self(to_screen, verbose):
         return
 
     version_id = versions_info['latest']
+
+    def version_tuple(version_str):
+        return tuple(map(int, version_str.split('.')))
+    if version_tuple(__version__) >= version_tuple(version_str):
+        to_screen(u'youtube-dl is up to date (%s)' % __version__)
+        return
+
     to_screen(u'Updating to version ' + version_id + '...')
     version = versions_info['versions'][version_id]