##// END OF EJS Templates
Backport PR #2067: update tools/release_windows.py...
Backport PR #2067: update tools/release_windows.py The first commit is the actual version of the file I used to build and upload the 0.13 installers to GitHub. The second commit fixes PyPI upload.

File last commit:

r7987:ef8bd66e
r7987:ef8bd66e
Show More
release_windows.py
52 lines | 1.4 KiB | text/x-python | PythonLexer
/ tools / release_windows.py
MinRK
add release_windows script...
r7763 """
build [and upload] Windows IPython releases
usage:
python tools/release_windows.py [--github] [--pypi]
Meant to be run on Windows
Requires that you have python and python3 on your PATH
"""
import glob
import os
import shutil
import sys
from toollib import sh
try:
import gh_api
except ImportError:
gh_api = None
github = '--github' in sys.argv
MinRK
Backport PR #2067: update tools/release_windows.py...
r7987 cmd_t = "{py} setup.py bdist_wininst --plat-name={plat}"
MinRK
add release_windows script...
r7763
MinRK
Backport PR #2067: update tools/release_windows.py...
r7987 pypi = '--pypi' in sys.argv
pypi_cmd_t = "python setup.py upload_wininst -f {fname}"
MinRK
add release_windows script...
r7763
for py in ['python', 'python3']:
# deliberately mangle the name,
# so easy_install doesn't find these and do horrible wrong things
v = 3 if py.endswith('3') else 2
try:
shutil.rmtree('build')
except OSError:
pass
MinRK
Backport PR #2067: update tools/release_windows.py...
r7987 for plat in ['win32', 'win-amd64']:
MinRK
add release_windows script...
r7763 cmd = cmd_t.format(**locals())
sh(cmd)
MinRK
Backport PR #2067: update tools/release_windows.py...
r7987 orig = glob.glob(os.path.join('dist', 'ipython-*.{plat}.exe'.format(**locals())))[0]
mangled = orig.replace('.{plat}.exe'.format(**locals()),
'.py{v}-{plat}.exe'.format(**locals())
)
os.rename(orig, mangled)
if pypi:
sh(pypi_cmd_t.format(fname=mangled))
MinRK
add release_windows script...
r7763 if github and gh_api:
MinRK
Backport PR #2067: update tools/release_windows.py...
r7987 print ("Uploading %s to GitHub" % mangled)
MinRK
add release_windows script...
r7763 desc = "IPython Installer for Python {v}.x on {plat}".format(**locals())
MinRK
Backport PR #2067: update tools/release_windows.py...
r7987 gh_api.post_download('ipython/ipython', mangled, description=desc)