summaryrefslogtreecommitdiffstats
path: root/Tools/msi
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-06-27 19:30:48 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-06-27 19:30:48 (GMT)
commit2e4cdb67d53423bcc79da852fb970f1e2c1779e1 (patch)
treeecc51f1e839754055998b02016d8bdc0bb622f1c /Tools/msi
parentaaa1767bd3e05b5e55c041162c4426d7437e7158 (diff)
downloadcpython-2e4cdb67d53423bcc79da852fb970f1e2c1779e1.zip
cpython-2e4cdb67d53423bcc79da852fb970f1e2c1779e1.tar.gz
cpython-2e4cdb67d53423bcc79da852fb970f1e2c1779e1.tar.bz2
Adds script for purging the caching server for downloads on python.org.
Diffstat (limited to 'Tools/msi')
-rw-r--r--Tools/msi/purge.py74
1 files changed, 74 insertions, 0 deletions
diff --git a/Tools/msi/purge.py b/Tools/msi/purge.py
new file mode 100644
index 0000000..76dbc49
--- /dev/null
+++ b/Tools/msi/purge.py
@@ -0,0 +1,74 @@
+# Purges the Fastly cache for Windows download files
+#
+# Usage:
+# py -3 purge.py 3.5.1rc1
+#
+
+__author__ = 'Steve Dower <steve.dower@python.org>'
+__version__ = '1.0.0'
+
+import re
+import sys
+
+from urllib.request import *
+
+VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)(\w+\d+)?$')
+
+try:
+ m = VERSION_RE.match(sys.argv[1])
+ if not m:
+ print('Invalid version:', sys.argv[1])
+ print('Expected something like "3.5.1rc1"')
+ sys.exit(1)
+except LookupError:
+ print('Missing version argument. Expected something like "3.5.1rc1"')
+ sys.exit(1)
+
+URL = "https://www.python.org/ftp/python/{}/".format(m.group(1))
+
+
+FILES = [
+ "core.msi",
+ "core_d.msi",
+ "core_pdb.msi",
+ "dev.msi",
+ "dev_d.msi",
+ "doc.msi",
+ "exe.msi",
+ "exe_d.msi",
+ "exe_pdb.msi",
+ "launcher.msi",
+ "lib.msi",
+ "lib_d.msi",
+ "lib_pdb.msi",
+ "path.msi",
+ "pip.msi",
+ "tcltk.msi",
+ "tcltk_d.msi",
+ "tcltk_pdb.msi",
+ "test.msi",
+ "test_d.msi",
+ "test_pdb.msi",
+ "tools.msi",
+ "Windows6.0-KB2999226-x64.msu",
+ "Windows6.0-KB2999226-x86.msu",
+ "Windows6.1-KB2999226-x64.msu",
+ "Windows6.1-KB2999226-x86.msu",
+ "Windows8.1-KB2999226-x64.msu",
+ "Windows8.1-KB2999226-x86.msu",
+ "Windows8-RT-KB2999226-x64.msu",
+ "Windows8-RT-KB2999226-x86.msu",
+]
+PATHS = [
+ "python-{}.exe".format(m.group(0)),
+ "python-{}-webinstall.exe".format(m.group(0)),
+ "python-{}-amd64.exe".format(m.group(0)),
+ "python-{}-amd64-webinstall.exe".format(m.group(0)),
+] + ["win32{}/{}".format(m.group(2), f) for f in FILES] + ["amd64{}/{}".format(m.group(2), f) for f in FILES]
+
+print('Purged:')
+for n in PATHS:
+ u = URL + n
+ with urlopen(Request(u, method='PURGE', headers={'Fastly-Soft-Purge': 1})) as r:
+ r.read()
+ print(' ', u)