release
85 lines
| 2.0 KiB
| text/plain
|
TextLexer
/ tools / release
Thomas Kluyver
|
r24250 | #!/usr/bin/env python3 | ||
Fernando Perez
|
r2118 | """IPython release script. | ||
Ville M. Vainio
|
r1032 | |||
Fernando Perez
|
r4450 | This should ONLY be run at real release time. | ||
Fernando Perez
|
r2118 | """ | ||
Fernando Perez
|
r4450 | from __future__ import print_function | ||
Ville M. Vainio
|
r1032 | |||
Matthias Bussonnier
|
r22021 | import os | ||
Matthias Bussonnier
|
r23953 | from glob import glob | ||
Thomas Kluyver
|
r23302 | from subprocess import call | ||
Matthias Bussonnier
|
r22021 | import sys | ||
Matthias Bussonnier
|
r22028 | from toollib import (get_ipdir, pjoin, cd, execfile, sh, archive, | ||
Matthias Bussonnier
|
r27320 | archive_user, archive_dir) | ||
Fernando Perez
|
r2118 | |||
# Get main ipython dir, this will raise if it doesn't pass some checks | ||||
ipdir = get_ipdir() | ||||
Fernando Perez
|
r4450 | tooldir = pjoin(ipdir, 'tools') | ||
distdir = pjoin(ipdir, 'dist') | ||||
Fernando Perez
|
r3135 | # Where I keep static backups of each release | ||
ipbackupdir = os.path.expanduser('~/ipython/backup') | ||||
MinRK
|
r17581 | if not os.path.exists(ipbackupdir): | ||
os.makedirs(ipbackupdir) | ||||
Fernando Perez
|
r3135 | |||
# Start in main IPython dir | ||||
Fernando Perez
|
r2118 | cd(ipdir) | ||
# Load release info | ||||
Matthias Bussonnier
|
r22028 | version = None | ||
Min RK
|
r19847 | execfile(pjoin('IPython','core','release.py'), globals()) | ||
Fernando Perez
|
r2118 | |||
Fernando Perez
|
r4450 | # Build site addresses for file uploads | ||
release_site = '%s/release/%s' % (archive, version) | ||||
Fernando Perez
|
r4457 | backup_site = '%s/backup/' % archive | ||
Fernando Perez
|
r4450 | |||
# Start actual release process | ||||
print() | ||||
print('Releasing IPython') | ||||
print('=================') | ||||
print() | ||||
print('Version:', version) | ||||
print() | ||||
print('Source IPython directory:', ipdir) | ||||
print() | ||||
Ville M. Vainio
|
r1032 | |||
Fernando Perez
|
r3135 | # Perform local backup, go to tools dir to run it. | ||
cd(tooldir) | ||||
Ville M. Vainio
|
r1032 | |||
Matthias Bussonnier
|
r22714 | if 'upload' in sys.argv: | ||
cd(distdir) | ||||
Ville M. Vainio
|
r1032 | |||
Matthias Bussonnier
|
r23953 | # do not upload OS specific files like .DS_Store | ||
Thomas Kluyver
|
r24019 | to_upload = glob('*.whl')+glob('*.tar.gz') | ||
Ville M. Vainio
|
r1032 | |||
Matthias Bussonnier
|
r22714 | # Make target dir if it doesn't exist | ||
Thomas Kluyver
|
r23302 | print('1. Uploading IPython to archive.ipython.org') | ||
Matthias Bussonnier
|
r22714 | sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version)) | ||
Matthias Bussonnier
|
r27381 | sh('scp *.tar.gz *.whl %s' % release_site) | ||
Matthias Bussonnier
|
r22043 | |||
Thomas Kluyver
|
r23302 | print('2. Uploading backup files...') | ||
Matthias Bussonnier
|
r22714 | cd(ipbackupdir) | ||
sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site) | ||||
Matthias Bussonnier
|
r22023 | |||
Thomas Kluyver
|
r23302 | print('3. Uploading to PyPI using twine') | ||
cd(distdir) | ||||
Matthias Bussonnier
|
r27317 | call(['twine', 'upload', '--verbose'] + to_upload) | ||
Thomas Kluyver
|
r23302 | |||
Matthias Bussonnier
|
r22714 | else: | ||
Thomas Kluyver
|
r23302 | # Build, but don't upload | ||
# Make backup tarball | ||||
Matthias Bussonnier
|
r27327 | sh('python make_tarball.py') | ||
Matthias Bussonnier
|
r22714 | sh('mv ipython-*.tgz %s' % ipbackupdir) | ||
Matthias Bussonnier
|
r22028 | |||
Matthias Bussonnier
|
r22714 | # Build release files | ||
Matthias Bussonnier
|
r25769 | sh('./build_release') | ||
Matthias Bussonnier
|
r22028 | |||
Matthias Bussonnier
|
r22714 | cd(ipdir) | ||
MinRK
|
r16795 | |||
Thomas Kluyver
|
r23302 | print("`./release upload` to upload source distribution on PyPI and ipython archive") | ||
Matthias Bussonnier
|
r22714 | sys.exit(0) | ||
MinRK
|
r8598 | |||
Ville M. Vainio
|
r1032 | |||