##// END OF EJS Templates
Backport PR #2546: use 4 Pythons to build 4 Windows installers...
MinRK -
Show More
@@ -1,52 +1,66 b''
1 """
1 """
2 build [and upload] Windows IPython releases
2 build [and upload] Windows IPython releases
3
3
4 usage:
4 usage:
5
5
6 python tools/release_windows.py [--github] [--pypi]
6 python tools/release_windows.py [--github] [--pypi]
7
7
8 Meant to be run on Windows
8 Meant to be run on Windows
9
9
10 Requires that you have python and python3 on your PATH
10 Requires that you have python and python3 on your PATH
11 """
11 """
12
12
13 import glob
13 import glob
14 import os
14 import os
15 import shutil
15 import shutil
16 import sys
16 import sys
17
17
18 from toollib import sh
18 from toollib import sh
19 try:
19 try:
20 import gh_api
20 import gh_api
21 except ImportError:
21 except ImportError:
22 gh_api = None
22 gh_api = None
23
23
24 github = '--github' in sys.argv
24 github = '--github' in sys.argv
25
25
26 cmd_t = "{py} setup.py bdist_wininst --plat-name={plat}"
26 cmd_t = "{py} setup.py bdist_wininst"
27
27
28 pypi = '--pypi' in sys.argv
28 pypi = '--pypi' in sys.argv
29 pypi_cmd_t = "python setup.py upload_wininst -f {fname}"
29 pypi_cmd_t = "python setup.py upload_wininst -f {fname}"
30
30
31 for py in ['python', 'python3']:
31 # Windows Python cannot normally cross-compile,
32 # so you must have 4 Pythons to make 4 installers:
33 # http://docs.python.org/2/distutils/builtdist.html#cross-compiling-on-windows
34
35 pythons = {
36 2: {
37 'win32' : r'C:\\Python27\Python.exe',
38 'win-amd64': r'C:\\Python27_64\Python.exe',
39 },
40 3: {
41 'win32' : r'C:\\Python33\Python.exe',
42 'win-amd64': r'C:\\Python33_64\Python.exe',
43 },
44 }
45
46 for v,plat_py in pythons.items():
32 # deliberately mangle the name,
47 # deliberately mangle the name,
33 # so easy_install doesn't find these and do horrible wrong things
48 # so easy_install doesn't find these and do horrible wrong things
34 v = 3 if py.endswith('3') else 2
35 try:
49 try:
36 shutil.rmtree('build')
50 shutil.rmtree('build')
37 except OSError:
51 except OSError:
38 pass
52 pass
39 for plat in ['win32', 'win-amd64']:
53 for plat,py in plat_py.items():
40 cmd = cmd_t.format(**locals())
54 cmd = cmd_t.format(**locals())
41 sh(cmd)
55 sh(cmd)
42 orig = glob.glob(os.path.join('dist', 'ipython-*.{plat}.exe'.format(**locals())))[0]
56 orig = glob.glob(os.path.join('dist', 'ipython-*.{plat}.exe'.format(**locals())))[0]
43 mangled = orig.replace('.{plat}.exe'.format(**locals()),
57 mangled = orig.replace('.{plat}.exe'.format(**locals()),
44 '.py{v}-{plat}.exe'.format(**locals())
58 '.py{v}-{plat}.exe'.format(**locals())
45 )
59 )
46 os.rename(orig, mangled)
60 os.rename(orig, mangled)
47 if pypi:
61 if pypi:
48 sh(pypi_cmd_t.format(fname=mangled))
62 sh(pypi_cmd_t.format(fname=mangled))
49 if github and gh_api:
63 if github and gh_api:
50 print ("Uploading %s to GitHub" % mangled)
64 print ("Uploading %s to GitHub" % mangled)
51 desc = "IPython Installer for Python {v}.x on {plat}".format(**locals())
65 desc = "IPython Installer for Python {v}.x on {plat}".format(**locals())
52 gh_api.post_download('ipython/ipython', mangled, description=desc)
66 gh_api.post_download('ipython/ipython', mangled, description=desc)
General Comments 0
You need to be logged in to leave comments. Login now