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