Show More
@@ -1,85 +1,85 b'' | |||||
1 | #!/usr/bin/env python3 |
|
1 | #!/usr/bin/env python3 | |
2 | """IPython release script. |
|
2 | """IPython release script. | |
3 |
|
3 | |||
4 | This should ONLY be run at real release time. |
|
4 | This should ONLY be run at real release time. | |
5 | """ |
|
5 | """ | |
6 | from __future__ import print_function |
|
6 | from __future__ import print_function | |
7 |
|
7 | |||
8 | import os |
|
8 | import os | |
9 | from glob import glob |
|
9 | from glob import glob | |
10 | from subprocess import call |
|
10 | from subprocess import call | |
11 | import sys |
|
11 | import sys | |
12 |
|
12 | |||
13 | from toollib import (get_ipdir, pjoin, cd, execfile, sh, archive, |
|
13 | from toollib import (get_ipdir, pjoin, cd, execfile, sh, archive, | |
14 | archive_user, archive_dir) |
|
14 | archive_user, archive_dir) | |
15 |
|
15 | |||
16 | # Get main ipython dir, this will raise if it doesn't pass some checks |
|
16 | # Get main ipython dir, this will raise if it doesn't pass some checks | |
17 | ipdir = get_ipdir() |
|
17 | ipdir = get_ipdir() | |
18 | tooldir = pjoin(ipdir, 'tools') |
|
18 | tooldir = pjoin(ipdir, 'tools') | |
19 | distdir = pjoin(ipdir, 'dist') |
|
19 | distdir = pjoin(ipdir, 'dist') | |
20 |
|
20 | |||
21 | # Where I keep static backups of each release |
|
21 | # Where I keep static backups of each release | |
22 | ipbackupdir = os.path.expanduser('~/ipython/backup') |
|
22 | ipbackupdir = os.path.expanduser('~/ipython/backup') | |
23 | if not os.path.exists(ipbackupdir): |
|
23 | if not os.path.exists(ipbackupdir): | |
24 | os.makedirs(ipbackupdir) |
|
24 | os.makedirs(ipbackupdir) | |
25 |
|
25 | |||
26 | # Start in main IPython dir |
|
26 | # Start in main IPython dir | |
27 | cd(ipdir) |
|
27 | cd(ipdir) | |
28 |
|
28 | |||
29 | # Load release info |
|
29 | # Load release info | |
30 | version = None |
|
30 | version = None | |
31 | execfile(pjoin('IPython','core','release.py'), globals()) |
|
31 | execfile(pjoin('IPython','core','release.py'), globals()) | |
32 |
|
32 | |||
33 | # Build site addresses for file uploads |
|
33 | # Build site addresses for file uploads | |
34 | release_site = '%s/release/%s' % (archive, version) |
|
34 | release_site = '%s/release/%s' % (archive, version) | |
35 | backup_site = '%s/backup/' % archive |
|
35 | backup_site = '%s/backup/' % archive | |
36 |
|
36 | |||
37 | # Start actual release process |
|
37 | # Start actual release process | |
38 | print() |
|
38 | print() | |
39 | print('Releasing IPython') |
|
39 | print('Releasing IPython') | |
40 | print('=================') |
|
40 | print('=================') | |
41 | print() |
|
41 | print() | |
42 | print('Version:', version) |
|
42 | print('Version:', version) | |
43 | print() |
|
43 | print() | |
44 | print('Source IPython directory:', ipdir) |
|
44 | print('Source IPython directory:', ipdir) | |
45 | print() |
|
45 | print() | |
46 |
|
46 | |||
47 | # Perform local backup, go to tools dir to run it. |
|
47 | # Perform local backup, go to tools dir to run it. | |
48 | cd(tooldir) |
|
48 | cd(tooldir) | |
49 |
|
49 | |||
50 | if 'upload' in sys.argv: |
|
50 | if 'upload' in sys.argv: | |
51 | cd(distdir) |
|
51 | cd(distdir) | |
52 |
|
52 | |||
53 | # do not upload OS specific files like .DS_Store |
|
53 | # do not upload OS specific files like .DS_Store | |
54 | to_upload = glob('*.whl')+glob('*.tar.gz') |
|
54 | to_upload = glob('*.whl')+glob('*.tar.gz') | |
55 |
|
55 | |||
56 | # Make target dir if it doesn't exist |
|
56 | # Make target dir if it doesn't exist | |
57 | print('1. Uploading IPython to archive.ipython.org') |
|
57 | print('1. Uploading IPython to archive.ipython.org') | |
58 | sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version)) |
|
58 | sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version)) | |
59 |
sh('scp *.tar.gz *. |
|
59 | sh('scp *.tar.gz *.whl %s' % release_site) | |
60 |
|
60 | |||
61 | print('2. Uploading backup files...') |
|
61 | print('2. Uploading backup files...') | |
62 | cd(ipbackupdir) |
|
62 | cd(ipbackupdir) | |
63 | sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site) |
|
63 | sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site) | |
64 |
|
64 | |||
65 | print('3. Uploading to PyPI using twine') |
|
65 | print('3. Uploading to PyPI using twine') | |
66 | cd(distdir) |
|
66 | cd(distdir) | |
67 | call(['twine', 'upload', '--verbose'] + to_upload) |
|
67 | call(['twine', 'upload', '--verbose'] + to_upload) | |
68 |
|
68 | |||
69 | else: |
|
69 | else: | |
70 | # Build, but don't upload |
|
70 | # Build, but don't upload | |
71 |
|
71 | |||
72 | # Make backup tarball |
|
72 | # Make backup tarball | |
73 | sh('python make_tarball.py') |
|
73 | sh('python make_tarball.py') | |
74 | sh('mv ipython-*.tgz %s' % ipbackupdir) |
|
74 | sh('mv ipython-*.tgz %s' % ipbackupdir) | |
75 |
|
75 | |||
76 | # Build release files |
|
76 | # Build release files | |
77 | sh('./build_release') |
|
77 | sh('./build_release') | |
78 |
|
78 | |||
79 | cd(ipdir) |
|
79 | cd(ipdir) | |
80 |
|
80 | |||
81 | print("`./release upload` to upload source distribution on PyPI and ipython archive") |
|
81 | print("`./release upload` to upload source distribution on PyPI and ipython archive") | |
82 | sys.exit(0) |
|
82 | sys.exit(0) | |
83 |
|
83 | |||
84 |
|
84 | |||
85 |
|
85 |
General Comments 0
You need to be logged in to leave comments.
Login now