1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-22 14:37:55 +01:00

Do not re-download files for hashsum generation (Fixes #1383)

This commit is contained in:
Philipp Hagemeister 2013-09-06 10:51:53 +02:00
parent 0638ad9999
commit 1d213233cd

View File

@ -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)