diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-02-22 21:44:38 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-02-22 21:44:38 +0100 |
commit | a9534762eadcb5f9d4773345f1dd7f0833a79a57 (patch) | |
tree | 086c71c5f4e59d6c975788417f10c0de7d15354b /maint | |
parent | 3a39396dd011d2dc6b746efd2c4c8211f70d5dfb (diff) | |
download | blogc-a9534762eadcb5f9d4773345f1dd7f0833a79a57.tar.gz blogc-a9534762eadcb5f9d4773345f1dd7f0833a79a57.tar.bz2 blogc-a9534762eadcb5f9d4773345f1dd7f0833a79a57.zip |
maint: added script to download distfiles
Diffstat (limited to 'maint')
-rw-r--r-- | maint/download_release.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/maint/download_release.py b/maint/download_release.py new file mode 100644 index 0000000..2d145b2 --- /dev/null +++ b/maint/download_release.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python2 +# coding: utf-8 + +import os +import re +import requests +import subprocess +import sys + +re_distfile = re.compile(r'(blogc[^\'"]+)\.sha512') +base_url = 'https://distfiles.rgm.io/blogc' +cwd = os.path.dirname(os.path.abspath(__file__)) + + +def download_release(version): + release_url = '%s/blogc-%s' % (base_url, version) + r = requests.get('%s/' % release_url) + r.raise_for_status() + + for distfile in set(re_distfile.findall(r.content)): + file_url = '%s/%s' % (release_url, distfile) + dest_path = os.path.join(cwd, 'releases', version) + subprocess.check_call(['wget', '-c', '-P', dest_path, file_url, + '%s.sha512' % file_url]) + subprocess.check_call(['sha512sum', '-c', '%s.sha512' % distfile], + cwd=dest_path) + + +if __name__ == '__main__': + download_release(sys.argv[1]) |