aboutsummaryrefslogtreecommitdiffstats
path: root/devscripts
diff options
context:
space:
mode:
Diffstat (limited to 'devscripts')
-rwxr-xr-xdevscripts/bash-completion.py5
-rw-r--r--devscripts/buildserver.py3
-rwxr-xr-xdevscripts/fish-completion.py1
-rwxr-xr-xdevscripts/gh-pages/sign-versions.py18
-rwxr-xr-xdevscripts/gh-pages/update-copyright.py2
-rwxr-xr-xdevscripts/gh-pages/update-feed.py1
-rwxr-xr-xdevscripts/gh-pages/update-sites.py1
-rw-r--r--devscripts/transition_helper.py8
-rw-r--r--devscripts/transition_helper_exe/setup.py2
-rw-r--r--devscripts/transition_helper_exe/youtube-dl.py22
10 files changed, 37 insertions, 26 deletions
diff --git a/devscripts/bash-completion.py b/devscripts/bash-completion.py
index 4928772..70a3f55 100755
--- a/devscripts/bash-completion.py
+++ b/devscripts/bash-completion.py
@@ -9,16 +9,17 @@ import youtube_dl
BASH_COMPLETION_FILE = "youtube-dl.bash-completion"
BASH_COMPLETION_TEMPLATE = "devscripts/bash-completion.in"
+
def build_completion(opt_parser):
opts_flag = []
for group in opt_parser.option_groups:
for option in group.option_list:
- #for every long flag
+ # for every long flag
opts_flag.append(option.get_opt_string())
with open(BASH_COMPLETION_TEMPLATE) as f:
template = f.read()
with open(BASH_COMPLETION_FILE, "w") as f:
- #just using the special char
+ # just using the special char
filled_template = template.replace("{{flags}}", " ".join(opts_flag))
f.write(filled_template)
diff --git a/devscripts/buildserver.py b/devscripts/buildserver.py
index e0c3cc8..42ee2b5 100644
--- a/devscripts/buildserver.py
+++ b/devscripts/buildserver.py
@@ -233,6 +233,7 @@ def rmtree(path):
#==============================================================================
+
class BuildError(Exception):
def __init__(self, output, code=500):
self.output = output
@@ -369,7 +370,7 @@ class Builder(PythonBuilder, GITBuilder, YoutubeDLBuilder, DownloadBuilder, Clea
class BuildHTTPRequestHandler(BaseHTTPRequestHandler):
- actionDict = { 'build': Builder, 'download': Builder } # They're the same, no more caching.
+ actionDict = {'build': Builder, 'download': Builder} # They're the same, no more caching.
def do_GET(self):
path = urlparse.urlparse(self.path)
diff --git a/devscripts/fish-completion.py b/devscripts/fish-completion.py
index f4aaf02..2185d55 100755
--- a/devscripts/fish-completion.py
+++ b/devscripts/fish-completion.py
@@ -23,6 +23,7 @@ EXTRA_ARGS = {
'batch-file': ['--require-parameter'],
}
+
def build_completion(opt_parser):
commands = []
diff --git a/devscripts/gh-pages/sign-versions.py b/devscripts/gh-pages/sign-versions.py
index 8a824df..953a516 100755
--- a/devscripts/gh-pages/sign-versions.py
+++ b/devscripts/gh-pages/sign-versions.py
@@ -11,22 +11,22 @@ except NameError:
versions_info = json.load(open('update/versions.json'))
if 'signature' in versions_info:
- del versions_info['signature']
+ del versions_info['signature']
print('Enter the PKCS1 private key, followed by a blank line:')
privkey = b''
while True:
- try:
- line = input()
- except EOFError:
- break
- if line == '':
- break
- privkey += line.encode('ascii') + b'\n'
+ try:
+ line = input()
+ except EOFError:
+ break
+ if line == '':
+ break
+ privkey += line.encode('ascii') + b'\n'
privkey = rsa.PrivateKey.load_pkcs1(privkey)
signature = hexlify(rsa.pkcs1.sign(json.dumps(versions_info, sort_keys=True).encode('utf-8'), privkey, 'SHA-256')).decode()
print('signature: ' + signature)
versions_info['signature'] = signature
-json.dump(versions_info, open('update/versions.json', 'w'), indent=4, sort_keys=True) \ No newline at end of file
+json.dump(versions_info, open('update/versions.json', 'w'), indent=4, sort_keys=True)
diff --git a/devscripts/gh-pages/update-copyright.py b/devscripts/gh-pages/update-copyright.py
index 12c2a91..5bc5c65 100755
--- a/devscripts/gh-pages/update-copyright.py
+++ b/devscripts/gh-pages/update-copyright.py
@@ -5,7 +5,7 @@ from __future__ import with_statement
import datetime
import glob
-import io # For Python 2 compatibilty
+import io # For Python 2 compatibilty
import os
import re
diff --git a/devscripts/gh-pages/update-feed.py b/devscripts/gh-pages/update-feed.py
index 0ba15ae..46373a8 100755
--- a/devscripts/gh-pages/update-feed.py
+++ b/devscripts/gh-pages/update-feed.py
@@ -73,4 +73,3 @@ atom_template = atom_template.replace('@ENTRIES@', entries_str)
with io.open('update/releases.atom', 'w', encoding='utf-8') as atom_file:
atom_file.write(atom_template)
-
diff --git a/devscripts/gh-pages/update-sites.py b/devscripts/gh-pages/update-sites.py
index 153e15c..0d52678 100755
--- a/devscripts/gh-pages/update-sites.py
+++ b/devscripts/gh-pages/update-sites.py
@@ -9,6 +9,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(
import youtube_dl
+
def main():
with open('supportedsites.html.in', 'r', encoding='utf-8') as tmplf:
template = tmplf.read()
diff --git a/devscripts/transition_helper.py b/devscripts/transition_helper.py
index d5ca2d4..cfd2191 100644
--- a/devscripts/transition_helper.py
+++ b/devscripts/transition_helper.py
@@ -4,7 +4,7 @@ import sys, os
try:
import urllib.request as compat_urllib_request
-except ImportError: # Python 2
+except ImportError: # Python 2
import urllib2 as compat_urllib_request
sys.stderr.write(u'Hi! We changed distribution method and now youtube-dl needs to update itself one more time.\n')
@@ -12,9 +12,9 @@ sys.stderr.write(u'This will only happen once. Simply press enter to go on. Sorr
sys.stderr.write(u'The new location of the binaries is https://github.com/rg3/youtube-dl/downloads, not the git repository.\n\n')
try:
- raw_input()
-except NameError: # Python 3
- input()
+ raw_input()
+except NameError: # Python 3
+ input()
filename = sys.argv[0]
diff --git a/devscripts/transition_helper_exe/setup.py b/devscripts/transition_helper_exe/setup.py
index aaf5c29..bb3264a 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 6297dfd..edb449f 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)