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