diff options
author | Jouke Waleson <jouke.waleson@mendix.com> | 2014-11-23 20:41:03 +0100 |
---|---|---|
committer | Jouke Waleson <jouke.waleson@mendix.com> | 2014-11-23 20:41:03 +0100 |
commit | 5f6a1245ffa9276c1af59b0835afeef67e2fb5b1 (patch) | |
tree | 139c6ede405cf3898e4639f0bf13d32d140fa5f1 /devscripts/transition_helper_exe | |
parent | 598c218f7b5c3e78f98dad40f45646c0c9ec773e (diff) |
PEP8 applied
Diffstat (limited to 'devscripts/transition_helper_exe')
-rw-r--r-- | devscripts/transition_helper_exe/setup.py | 2 | ||||
-rw-r--r-- | devscripts/transition_helper_exe/youtube-dl.py | 22 |
2 files changed, 16 insertions, 8 deletions
diff --git a/devscripts/transition_helper_exe/setup.py b/devscripts/transition_helper_exe/setup.py index aaf5c2983..bb3264af0 100644 --- a/devscripts/transition_helper_exe/setup.py +++ b/devscripts/transition_helper_exe/setup.py @@ -9,4 +9,4 @@ py2exe_options = { "dll_excludes": ['w9xpopen.exe'] } -setup(console=['youtube-dl.py'], options={ "py2exe": py2exe_options }, zipfile=None)
\ No newline at end of file +setup(console=['youtube-dl.py'], options={"py2exe": py2exe_options}, zipfile=None) diff --git a/devscripts/transition_helper_exe/youtube-dl.py b/devscripts/transition_helper_exe/youtube-dl.py index 6297dfd40..edb449fb3 100644 --- a/devscripts/transition_helper_exe/youtube-dl.py +++ b/devscripts/transition_helper_exe/youtube-dl.py @@ -4,13 +4,17 @@ import sys, os import urllib2 import json, hashlib + def rsa_verify(message, signature, key): from struct import pack from hashlib import sha256 from sys import version_info + def b(x): - if version_info[0] == 2: return x - else: return x.encode('latin1') + if version_info[0] == 2: + return x + else: + return x.encode('latin1') assert(type(message) == type(b(''))) block_size = 0 n = key[0] @@ -23,13 +27,17 @@ def rsa_verify(message, signature, key): raw_bytes.insert(0, pack("B", signature & 0xFF)) signature >>= 8 signature = (block_size - len(raw_bytes)) * b('\x00') + b('').join(raw_bytes) - if signature[0:2] != b('\x00\x01'): return False + if signature[0:2] != b('\x00\x01'): + return False signature = signature[2:] - if not b('\x00') in signature: return False + if not b('\x00') in signature: + return False signature = signature[signature.index(b('\x00'))+1:] - if not signature.startswith(b('\x30\x31\x30\x0D\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20')): return False + if not signature.startswith(b('\x30\x31\x30\x0D\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20')): + return False signature = signature[19:] - if signature != sha256(message).digest(): return False + if signature != sha256(message).digest(): + return False return True sys.stderr.write(u'Hi! We changed distribution method and now youtube-dl needs to update itself one more time.\n') @@ -92,7 +100,7 @@ echo Updating youtube-dl... ping 127.0.0.1 -n 5 -w 1000 > NUL move /Y "%s.new" "%s" del "%s" - \n""" %(exe, exe, bat)) + \n""" % (exe, exe, bat)) b.close() os.startfile(bat) |