From 9ca7f036907d6b08a4b06c8fb22bbc6989f84416 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 26 Sep 2014 23:30:31 -0400 Subject: Refs #1224 -- try to purge PyPI after new tarball is uploaded Also reuse an HTTP connection for stuff --- tasks.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index c9fdfa99..5733cc4e 100644 --- a/tasks.py +++ b/tasks.py @@ -25,9 +25,9 @@ import requests JENKINS_URL = "https://jenkins.cryptography.io/job/cryptography-wheel-builder" -def wait_for_build_completed(): +def wait_for_build_completed(session): while True: - response = requests.get( + response = session.get( "{0}/lastBuild/api/json/".format(JENKINS_URL), headers={ "Accept": "application/json", @@ -40,8 +40,8 @@ def wait_for_build_completed(): time.sleep(0.1) -def download_artifacts(): - response = requests.get( +def download_artifacts(session): + response = session.get( "{0}/lastBuild/api/json/".format(JENKINS_URL), headers={ "Accept": "application/json" @@ -54,7 +54,7 @@ def download_artifacts(): paths = [] for run in response.json()["runs"]: - response = requests.get( + response = session.get( run["url"] + "api/json/", headers={ "Accept": "application/json", @@ -62,7 +62,7 @@ def download_artifacts(): ) response.raise_for_status() for artifact in response.json()["artifacts"]: - response = requests.get( + response = session.get( "{0}artifact/{1}".format(run["url"], artifact["relativePath"]) ) out_path = os.path.join( @@ -92,9 +92,14 @@ def release(version): "vectors/dist/cryptography_vectors-{0}*".format(version) ) + session = requests.Session() + + response = session.request("PURGE", "https://pypi.python.org/simple/cryptography/") + response.raise_for_status() + username = getpass.getpass("Input the GitHub/Jenkins username: ") token = getpass.getpass("Input the Jenkins token: ") - response = requests.post( + response = session.post( "{0}/build".format(JENKINS_URL), auth=requests.auth.HTTPBasicAuth( username, token @@ -104,6 +109,6 @@ def release(version): } ) response.raise_for_status() - wait_for_build_completed() - paths = download_artifacts() + wait_for_build_completed(session) + paths = download_artifacts(session) invoke.run("twine upload {0}".format(" ".join(paths))) -- cgit v1.2.3 From 0f74a2c128447f0546acab23fbfe87be9a3ea9b6 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 26 Sep 2014 23:31:19 -0400 Subject: line length --- tasks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index 5733cc4e..50eb90ae 100644 --- a/tasks.py +++ b/tasks.py @@ -94,7 +94,9 @@ def release(version): session = requests.Session() - response = session.request("PURGE", "https://pypi.python.org/simple/cryptography/") + response = session.request( + "PURGE", "https://pypi.python.org/simple/cryptography/" + ) response.raise_for_status() username = getpass.getpass("Input the GitHub/Jenkins username: ") -- cgit v1.2.3 From b44158ee2190cabf2c6c26ffa98d6e22a98aac58 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 28 Sep 2014 12:00:49 -0400 Subject: Added an explanatory comment. --- tasks.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index 50eb90ae..860584b1 100644 --- a/tasks.py +++ b/tasks.py @@ -94,6 +94,9 @@ def release(version): session = requests.Session() + # This tells the CDN to delete the cached response for the URL. We do this + # so that the Jenkins builders will see the new sdist immediately when they + # go to build the wheels. response = session.request( "PURGE", "https://pypi.python.org/simple/cryptography/" ) -- cgit v1.2.3