From a43376321bd3d1d84c6e559463ad15bbb10ed398 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Fri, 4 Oct 2019 01:40:47 +0800 Subject: scripts: fix col80 --- scripts/run_bp.py | 36 ++++++++++++++++++++++++++---------- scripts/run_bp.py.sha1 | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/scripts/run_bp.py b/scripts/run_bp.py index e0e1f5810..6153db280 100755 --- a/scripts/run_bp.py +++ b/scripts/run_bp.py @@ -43,11 +43,18 @@ _SCRIPT_REPO = 'go-tangerine' _SCRIPT_BRANCH = 'master' _SCRIPT_PATH = 'scripts/run_bp.py' _SCRIPT_SRC = ('https://raw.githubusercontent.com/' - '%s/%s/%s/%s' % (_SCRIPT_ORG, _SCRIPT_REPO, _SCRIPT_BRANCH, _SCRIPT_PATH)) + '%s/%s/%s/%s' % + (_SCRIPT_ORG, + _SCRIPT_REPO, + _SCRIPT_BRANCH, + _SCRIPT_PATH)) _SCRIPT_APPROVE_PATH_TMPL = _SCRIPT_PATH + '.%s' _SCRIPT_APPROVE_SRC_TMPL = ('https://raw.githubusercontent.com/' - '%s/%s/%%s/%s' % (_SCRIPT_ORG, _SCRIPT_REPO, _SCRIPT_APPROVE_PATH_TMPL)) -_SCRIPT_APPROVER = ['aitjcize', 'popodidi', 'JM00oo', 'Spiderpowa'] + '%s/%s/%%s/%s' % + (_SCRIPT_ORG, + _SCRIPT_REPO, + _SCRIPT_APPROVE_PATH_TMPL)) +_SCRIPT_APPROVER = ['aitjcize', 'JM00oo', 'Spiderpowa'] _SCRIPT_APPROVE_THRESHOLD = int(len(_SCRIPT_APPROVER)/2) _GITHUB_API = 'https://api.github.com' @@ -166,12 +173,18 @@ def check_environment(): def github_get_commits(path): - return '%s/repos/%s/%s/commits?path=%s&sha=%s' % (_GITHUB_API, _SCRIPT_ORG, _SCRIPT_REPO, path, _SCRIPT_BRANCH) + return ('%s/repos/%s/%s/commits?path=%s&sha=%s' % + (_GITHUB_API, + _SCRIPT_ORG, + _SCRIPT_REPO, + path, + _SCRIPT_BRANCH)) def github_get_approved_commit(commit, approver): - with urllib.request.urlopen(github_get_commits(_SCRIPT_APPROVE_PATH_TMPL % approver), - timeout=_REQUEST_TIMEOUT) as f: + with urllib.request.urlopen( + github_get_commits(_SCRIPT_APPROVE_PATH_TMPL % approver), + timeout=_REQUEST_TIMEOUT) as f: if f.getcode() != 200: raise RuntimeError('unable to get approver metadata') for item in json.loads(f.read()): @@ -179,8 +192,9 @@ def github_get_approved_commit(commit, approver): continue if item['author']['login'] != approver: continue - with urllib.request.urlopen(_SCRIPT_APPROVE_SRC_TMPL % (commit, approver), - timeout=_REQUEST_TIMEOUT) as f2: + with urllib.request.urlopen( + _SCRIPT_APPROVE_SRC_TMPL % (commit, approver), + timeout=_REQUEST_TIMEOUT) as f2: if f2.getcode() != 200: raise RuntimeError('unable to get approver file') if f2.read().decode('utf-8') == commit: @@ -206,7 +220,8 @@ def check_for_update(): data = f.read() size = len(data) sha1sum = hashlib.sha1( - ('blob ' + str(size) + "\0" + data.decode('utf-8')).encode('utf-8')).hexdigest() + ('blob ' + str(size) + "\0" + + data.decode('utf-8')).encode('utf-8')).hexdigest() found = False with urllib.request.urlopen(github_get_commits(_SCRIPT_PATH), @@ -248,7 +263,8 @@ def check_for_update(): script_data = f.read() size = len(script_data) new_sha1sum = hashlib.sha1( - ('blob ' + str(size) + "\0" + script_data.decode('utf-8')).encode('utf-8')).hexdigest() + ('blob ' + str(size) + "\0" + + script_data.decode('utf-8')).encode('utf-8')).hexdigest() if new_sha1sum != update_sha1sum: raise RuntimeError('failed to verify upgrade payload, aborted') diff --git a/scripts/run_bp.py.sha1 b/scripts/run_bp.py.sha1 index 94cef533d..6dc5d2099 100644 --- a/scripts/run_bp.py.sha1 +++ b/scripts/run_bp.py.sha1 @@ -1 +1 @@ -0b589748b799032761929b4151b150cdcdc95656 +854cce9e78d1d74332c3b9a0a41a10e38b72e45e -- cgit