diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2020-04-22 14:52:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 15:52:20 -0400 |
commit | 23648a4236acd5e7e18e82bee71f43146e09c857 (patch) | |
tree | 9c42bf2ad2111cadf55e355d1df6312c6b07bbbf /.github/workflows/download_openssl.py | |
parent | a7f846e0d694b1d007adb09d86482b909a8ab9f5 (diff) | |
download | cryptography-23648a4236acd5e7e18e82bee71f43146e09c857.tar.gz cryptography-23648a4236acd5e7e18e82bee71f43146e09c857.tar.bz2 cryptography-23648a4236acd5e7e18e82bee71f43146e09c857.zip |
use our infra built openssl on the macos side now too (#5217)
* use our infra built openssl on the macos side now too
* remove no longer required brew updates
* need requests
* need this env var
* update the wheel-builders too
Diffstat (limited to '.github/workflows/download_openssl.py')
-rw-r--r-- | .github/workflows/download_openssl.py | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/.github/workflows/download_openssl.py b/.github/workflows/download_openssl.py index f665e7f0..78e5135c 100644 --- a/.github/workflows/download_openssl.py +++ b/.github/workflows/download_openssl.py @@ -6,12 +6,6 @@ import zipfile import requests -RUNS_URL = ( - "https://api.github.com/repos/pyca/infra/actions/workflows/" - "build-openssl.yml/runs?branch=master&status=success" -) - - def get_response(url, token): response = requests.get(url, headers={"Authorization": "token " + token}) if response.status_code != 200: @@ -21,11 +15,24 @@ def get_response(url, token): return response -def main(target): +def main(platform, target): + if platform == "windows": + workflow = "build-openssl.yml" + path = "C:/" + elif platform == "macos": + workflow = "build-macos-openssl.yml" + path = os.environ["HOME"] + else: + raise ValueError("Invalid platform") + token = os.environ["GITHUB_TOKEN"] print("Looking for: {}".format(target)) + runs_url = ( + "https://api.github.com/repos/pyca/infra/actions/workflows/" + "{}/runs?branch=master&status=success".format(workflow) + ) - response = get_response(RUNS_URL, token).json() + response = get_response(runs_url, token).json() artifacts_url = response["workflow_runs"][0]["artifacts_url"] response = get_response(artifacts_url, token).json() for artifact in response["artifacts"]: @@ -35,10 +42,10 @@ def main(target): artifact["archive_download_url"], token ) zipfile.ZipFile(io.BytesIO(response.content)).extractall( - "C:/{}".format(artifact["name"]) + os.path.join(path, artifact["name"]) ) return if __name__ == "__main__": - main(sys.argv[1]) + main(sys.argv[1], sys.argv[2]) |