From 1d213233cdb788c6b323a6b056f215789fe30f13 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Fri, 6 Sep 2013 10:51:53 +0200 Subject: [PATCH] Do not re-download files for hashsum generation (Fixes #1383) --- devscripts/gh-pages/add-version.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/devscripts/gh-pages/add-version.py b/devscripts/gh-pages/add-version.py index 116420ef2..03733c35d 100755 --- a/devscripts/gh-pages/add-version.py +++ b/devscripts/gh-pages/add-version.py @@ -23,10 +23,13 @@ filenames = { 'bin': 'youtube-dl', 'exe': 'youtube-dl.exe', 'tar': 'youtube-dl-%s.tar.gz' % version} +build_dir = os.path.join('..', '..', 'build', version) for key, filename in filenames.items(): - print('Downloading and checksumming %s...' % filename) - url = 'https://yt-dl.org/downloads/%s/%s' % (version, filename) - data = urllib.request.urlopen(url).read() + fn = os.path.join(build_dir, filename) + with open(fn, 'rb') as f: + data = f.read() + if not data: + raise ValueError('File %s is empty!' % fn) sha256sum = hashlib.sha256(data).hexdigest() new_version[key] = (url, sha256sum) -- 2.39.5