summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2016-02-14 12:30:55 -0800
committerBob Ippolito <bob@redivi.com>2016-02-15 09:51:34 -0800
commit8aaf1ca7d6cda799997815591c1c82e70c51a633 (patch)
treec0a3471da60ae560dc1f43f0ffabfdbbff6b40e0 /scripts
parent60227944e9879362f9a4e09dfaae605273cdfc8c (diff)
downloadsimplejson-8aaf1ca7d6cda799997815591c1c82e70c51a633.tar.gz
v3.8.2 - fix compiler warning, automated wheel builds for Windows and Macv3.8.2wheels
Diffstat (limited to 'scripts')
-rw-r--r--scripts/artifacts.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/scripts/artifacts.py b/scripts/artifacts.py
new file mode 100644
index 0000000..48ae2fb
--- /dev/null
+++ b/scripts/artifacts.py
@@ -0,0 +1,48 @@
+try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib import urlopen
+
+import io
+import json
+import subprocess
+
+
+def get_json(url):
+ return json.load(io.TextIOWrapper(urlopen(url), encoding='utf-8'))
+
+
+def download_file(src_url, dest_path):
+ print(dest_path)
+ subprocess.call(
+ ['curl', '-L', '-#', '-o', dest_path, src_url])
+
+
+def download_appveyor_artifacts():
+ api_url = 'https://ci.appveyor.com/api'
+ builds = get_json(
+ '{}/projects/etrepum/simplejson'.format(api_url))
+
+ for job in builds['build']['jobs']:
+ url = '{api_url}/buildjobs/{jobId}/artifacts'.format(
+ api_url=api_url, **job)
+ for artifact in get_json(url):
+ download_file(
+ '{url}/{fileName}'.format(url=url, **artifact),
+ artifact['fileName'])
+
+
+def download_github_artifacts():
+ release = get_json(
+ 'https://api.github.com/repos/simplejson/simplejson/releases/latest')
+ for asset in release['assets']:
+ download_file(asset['url'], 'dist/{name}'.format(**asset))
+
+
+def main():
+ download_appveyor_artifacts()
+ download_github_artifacts()
+
+
+if __name__ == '__main__':
+ main()