Show More
@@ -1,81 +1,84 b'' | |||||
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 | from toollib import * |
|
8 | from toollib import * | |
9 | from gh_api import post_download |
|
9 | from gh_api import post_download | |
10 |
|
10 | |||
11 | # Get main ipython dir, this will raise if it doesn't pass some checks |
|
11 | # Get main ipython dir, this will raise if it doesn't pass some checks | |
12 | ipdir = get_ipdir() |
|
12 | ipdir = get_ipdir() | |
13 | tooldir = pjoin(ipdir, 'tools') |
|
13 | tooldir = pjoin(ipdir, 'tools') | |
14 | distdir = pjoin(ipdir, 'dist') |
|
14 | distdir = pjoin(ipdir, 'dist') | |
15 |
|
15 | |||
16 | # Where I keep static backups of each release |
|
16 | # Where I keep static backups of each release | |
17 | ipbackupdir = os.path.expanduser('~/ipython/backup') |
|
17 | ipbackupdir = os.path.expanduser('~/ipython/backup') | |
18 | if not os.path.exists(ipbackupdir): |
|
18 | if not os.path.exists(ipbackupdir): | |
19 | os.makedirs(ipbackupdir) |
|
19 | os.makedirs(ipbackupdir) | |
20 |
|
20 | |||
21 | # Start in main IPython dir |
|
21 | # Start in main IPython dir | |
22 | cd(ipdir) |
|
22 | cd(ipdir) | |
23 |
|
23 | |||
24 | # Load release info |
|
24 | # Load release info | |
25 | execfile(pjoin('IPython','core','release.py'), globals()) |
|
25 | execfile(pjoin('IPython','core','release.py'), globals()) | |
26 |
|
26 | |||
27 | # Build site addresses for file uploads |
|
27 | # Build site addresses for file uploads | |
28 | release_site = '%s/release/%s' % (archive, version) |
|
28 | release_site = '%s/release/%s' % (archive, version) | |
29 | backup_site = '%s/backup/' % archive |
|
29 | backup_site = '%s/backup/' % archive | |
30 |
|
30 | |||
31 | # Start actual release process |
|
31 | # Start actual release process | |
32 | print() |
|
32 | print() | |
33 | print('Releasing IPython') |
|
33 | print('Releasing IPython') | |
34 | print('=================') |
|
34 | print('=================') | |
35 | print() |
|
35 | print() | |
36 | print('Version:', version) |
|
36 | print('Version:', version) | |
37 | print() |
|
37 | print() | |
38 | print('Source IPython directory:', ipdir) |
|
38 | print('Source IPython directory:', ipdir) | |
39 | print() |
|
39 | print() | |
40 |
|
40 | |||
41 | # Perform local backup, go to tools dir to run it. |
|
41 | # Perform local backup, go to tools dir to run it. | |
42 | cd(tooldir) |
|
42 | cd(tooldir) | |
43 | sh('./make_tarball.py') |
|
43 | sh('./make_tarball.py') | |
44 | sh('mv ipython-*.tgz %s' % ipbackupdir) |
|
44 | sh('mv ipython-*.tgz %s' % ipbackupdir) | |
45 |
|
45 | |||
46 | # Build release files |
|
46 | # Build release files | |
47 | sh('./build_release %s' % ipdir) |
|
47 | sh('./build_release %s' % ipdir) | |
48 |
|
48 | |||
49 | if 'upload' not in sys.argv: |
|
49 | if 'upload' not in sys.argv: | |
50 | print("`./release upload` to register and release") |
|
50 | print("`./release upload` to register and release") | |
51 | sys.exit(0) |
|
51 | sys.exit(0) | |
52 |
|
52 | |||
53 | # Register with the Python Package Index (PyPI) |
|
53 | # Register with the Python Package Index (PyPI) | |
54 | print( 'Registering with PyPI...') |
|
54 | print( 'Not Registering with PyPI, registering with setup.py is insecure as communication is not encrypted') | |
55 | cd(ipdir) |
|
55 | cd(ipdir) | |
56 | sh('./setup.py register') |
|
56 | # sh('./setup.py register') | |
57 |
|
57 | |||
58 | # Upload all files |
|
58 | # Upload all files | |
59 |
sh(sdists |
|
59 | sh(sdists) | |
60 | for py in ('2.7', '3.4'): |
|
60 | for py in ('2.7', '3.4'): | |
61 |
sh('python%s setupegg.py bdist_wheel |
|
61 | sh('python%s setupegg.py bdist_wheel' % py) | |
|
62 | ||||
|
63 | print('Will not upload with setuptools as upload connection is insecure. Please use `twine upload dist/*` to upload the files to PyPI') | |||
62 |
|
64 | |||
63 | cd(distdir) |
|
65 | cd(distdir) | |
64 | print( 'Uploading distribution files...') |
|
66 | print( 'Uploading distribution files to GitHub...') | |
65 |
|
67 | |||
66 | for fname in os.listdir('.'): |
|
68 | for fname in os.listdir('.'): | |
67 | # TODO: update to GitHub releases API |
|
69 | # TODO: update to GitHub releases API | |
68 | continue |
|
70 | continue | |
69 | print('uploading %s to GitHub' % fname) |
|
71 | print('uploading %s to GitHub' % fname) | |
70 | desc = "IPython %s source distribution" % version |
|
72 | desc = "IPython %s source distribution" % version | |
71 | post_download("ipython/ipython", fname, description=desc) |
|
73 | post_download("ipython/ipython", fname, description=desc) | |
72 |
|
74 | |||
73 | # Make target dir if it doesn't exist |
|
75 | # Make target dir if it doesn't exist | |
|
76 | print('Uploading IPython to backup site.') | |||
74 | sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version)) |
|
77 | sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version)) | |
75 | sh('scp * %s' % release_site) |
|
78 | sh('scp * %s' % release_site) | |
76 |
|
79 | |||
77 | print( 'Uploading backup files...') |
|
80 | print( 'Uploading backup files...') | |
78 | cd(ipbackupdir) |
|
81 | cd(ipbackupdir) | |
79 | sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site) |
|
82 | sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site) | |
80 |
|
83 | |||
81 | print('Done!') |
|
84 | print('Done!') |
@@ -1,65 +1,64 b'' | |||||
1 | """Various utilities common to IPython release and maintenance tools. |
|
1 | """Various utilities common to IPython release and maintenance tools. | |
2 | """ |
|
2 | """ | |
3 | from __future__ import print_function |
|
3 | from __future__ import print_function | |
4 |
|
4 | |||
5 | # Library imports |
|
5 | # Library imports | |
6 | import os |
|
6 | import os | |
7 | import sys |
|
|||
8 |
|
7 | |||
9 | # Useful shorthands |
|
8 | # Useful shorthands | |
10 | pjoin = os.path.join |
|
9 | pjoin = os.path.join | |
11 | cd = os.chdir |
|
10 | cd = os.chdir | |
12 |
|
11 | |||
13 | # Constants |
|
12 | # Constants | |
14 |
|
13 | |||
15 | # SSH root address of the archive site |
|
14 | # SSH root address of the archive site | |
16 | archive_user = 'ipython@archive.ipython.org' |
|
15 | archive_user = 'ipython@archive.ipython.org' | |
17 | archive_dir = 'archive.ipython.org' |
|
16 | archive_dir = 'archive.ipython.org' | |
18 | archive = '%s:%s' % (archive_user, archive_dir) |
|
17 | archive = '%s:%s' % (archive_user, archive_dir) | |
19 |
|
18 | |||
20 | # Build commands |
|
19 | # Build commands | |
21 | # Source dists |
|
20 | # Source dists | |
22 | sdists = './setup.py sdist --formats=gztar,zip' |
|
21 | sdists = './setup.py sdist --formats=gztar,zip' | |
23 | # Binary dists |
|
22 | # Binary dists | |
24 | wheels = './setupegg.py bdist_wheel' |
|
23 | wheels = './setupegg.py bdist_wheel' | |
25 |
|
24 | |||
26 | # Utility functions |
|
25 | # Utility functions | |
27 | def sh(cmd): |
|
26 | def sh(cmd): | |
28 | """Run system command in shell, raise SystemExit if it returns an error.""" |
|
27 | """Run system command in shell, raise SystemExit if it returns an error.""" | |
29 | print("$", cmd) |
|
28 | print("$", cmd) | |
30 | stat = os.system(cmd) |
|
29 | stat = os.system(cmd) | |
31 | #stat = 0 # Uncomment this and comment previous to run in debug mode |
|
30 | #stat = 0 # Uncomment this and comment previous to run in debug mode | |
32 | if stat: |
|
31 | if stat: | |
33 | raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) |
|
32 | raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) | |
34 |
|
33 | |||
35 | # Backwards compatibility |
|
34 | # Backwards compatibility | |
36 | c = sh |
|
35 | c = sh | |
37 |
|
36 | |||
38 | def get_ipdir(): |
|
37 | def get_ipdir(): | |
39 | """Get IPython directory from command line, or assume it's the one above.""" |
|
38 | """Get IPython directory from command line, or assume it's the one above.""" | |
40 |
|
39 | |||
41 | # Initialize arguments and check location |
|
40 | # Initialize arguments and check location | |
42 | ipdir = pjoin(os.path.dirname(__file__), os.pardir) |
|
41 | ipdir = pjoin(os.path.dirname(__file__), os.pardir) | |
43 |
|
42 | |||
44 | ipdir = os.path.abspath(ipdir) |
|
43 | ipdir = os.path.abspath(ipdir) | |
45 |
|
44 | |||
46 | cd(ipdir) |
|
45 | cd(ipdir) | |
47 | if not os.path.isdir('IPython') and os.path.isfile('setup.py'): |
|
46 | if not os.path.isdir('IPython') and os.path.isfile('setup.py'): | |
48 | raise SystemExit('Invalid ipython directory: %s' % ipdir) |
|
47 | raise SystemExit('Invalid ipython directory: %s' % ipdir) | |
49 | return ipdir |
|
48 | return ipdir | |
50 |
|
49 | |||
51 |
|
50 | |||
52 | def compile_tree(): |
|
51 | def compile_tree(): | |
53 | """Compile all Python files below current directory.""" |
|
52 | """Compile all Python files below current directory.""" | |
54 | stat = os.system('python -m compileall .') |
|
53 | stat = os.system('python -m compileall .') | |
55 | if stat: |
|
54 | if stat: | |
56 | msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n' |
|
55 | msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n' | |
57 | msg += 'See messages above for the actual file that produced it.\n' |
|
56 | msg += 'See messages above for the actual file that produced it.\n' | |
58 | raise SystemExit(msg) |
|
57 | raise SystemExit(msg) | |
59 |
|
58 | |||
60 | try: |
|
59 | try: | |
61 | execfile |
|
60 | execfile | |
62 | except NameError: |
|
61 | except NameError: | |
63 | def execfile(fname, globs, locs=None): |
|
62 | def execfile(fname, globs, locs=None): | |
64 | locs = locs or globs |
|
63 | locs = locs or globs | |
65 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) |
|
64 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) |
General Comments 0
You need to be logged in to leave comments.
Login now