##// END OF EJS Templates
Merge pull request #6281 from minrk/further-fix-release...
Thomas Kluyver -
r17633:a68d1d4d merge
parent child Browse files
Show More
@@ -1,27 +1,28 b''
1 1 #!/usr/bin/env python
2 2 """IPython release build script.
3 3 """
4 4
5 5 import os
6 from shutil import rmtree
6 7
7 8 from toollib import *
8 9
9 10 # Get main ipython dir, this will raise if it doesn't pass some checks
10 11 ipdir = get_ipdir()
11 12 cd(ipdir)
12 13
13 14 # Load release info
14 15 execfile(pjoin('IPython', 'core', 'release.py'))
15 16
16 17 # Check that everything compiles
17 18 compile_tree()
18 19
19 20 # Cleanup
20 21 for d in ['build', 'dist', pjoin('docs', 'build'), pjoin('docs', 'dist'),
21 22 pjoin('docs', 'source', 'api', 'generated')]:
22 23 if os.path.isdir(d):
23 remove_tree(d)
24 rmtree(d)
24 25
25 26 # Build source and binary distros
26 27 sh(sdists)
27 28 sh(wheels)
@@ -1,79 +1,79 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'))
26 26 # ensure js version is in sync
27 27 sh('./setup.py jsversion')
28 28
29 29 # Build site addresses for file uploads
30 30 release_site = '%s/release/%s' % (archive, version)
31 31 backup_site = '%s/backup/' % archive
32 32
33 33 # Start actual release process
34 34 print()
35 35 print('Releasing IPython')
36 36 print('=================')
37 37 print()
38 38 print('Version:', version)
39 39 print()
40 40 print('Source IPython directory:', ipdir)
41 41 print()
42 42
43 43 # Perform local backup, go to tools dir to run it.
44 44 cd(tooldir)
45 45 sh('./make_tarball.py')
46 46 sh('mv ipython-*.tgz %s' % ipbackupdir)
47 47
48 48 # Build release files
49 49 sh('./build_release %s' % ipdir)
50 50
51 51 # Register with the Python Package Index (PyPI)
52 52 print( 'Registering with PyPI...')
53 53 cd(ipdir)
54 54 sh('./setup.py register')
55 55
56 56 # Upload all files
57 57 sh(sdists + ' upload')
58 58 for py in ('2.7', '3.4'):
59 sh('python%s setupegg.py bdist_wheel' % py)
59 sh('python%s setupegg.py bdist_wheel upload' % py)
60 60
61 61 cd(distdir)
62 62 print( 'Uploading distribution files...')
63 63
64 64 for fname in os.listdir('.'):
65 65 # TODO: update to GitHub releases API
66 66 continue
67 67 print('uploading %s to GitHub' % fname)
68 68 desc = "IPython %s source distribution" % version
69 69 post_download("ipython/ipython", fname, description=desc)
70 70
71 71 # Make target dir if it doesn't exist
72 72 sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version))
73 73 sh('scp * %s' % release_site)
74 74
75 75 print( 'Uploading backup files...')
76 76 cd(ipbackupdir)
77 77 sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site)
78 78
79 79 print('Done!')
@@ -1,61 +1,61 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 7 import sys
8 8
9 9 # Useful shorthands
10 10 pjoin = os.path.join
11 11 cd = os.chdir
12 12
13 13 # Constants
14 14
15 15 # SSH root address of the archive site
16 16 archive_user = 'ipython@archive.ipython.org'
17 17 archive_dir = 'archive.ipython.org'
18 18 archive = '%s:%s' % (archive_user, archive_dir)
19 19
20 20 # Build commands
21 21 # Source dists
22 22 sdists = './setup.py sdist --formats=gztar,zip'
23 23 # Binary dists
24 24 wheels = './setupegg.py bdist_wheel'
25 25
26 26 # Utility functions
27 27 def sh(cmd):
28 28 """Run system command in shell, raise SystemExit if it returns an error."""
29 29 print("$", cmd)
30 30 stat = os.system(cmd)
31 31 #stat = 0 # Uncomment this and comment previous to run in debug mode
32 32 if stat:
33 33 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
34 34
35 35 # Backwards compatibility
36 36 c = sh
37 37
38 38 def get_ipdir():
39 39 """Get IPython directory from command line, or assume it's the one above."""
40 40
41 41 # Initialize arguments and check location
42 42 try:
43 43 ipdir = sys.argv[1]
44 44 except IndexError:
45 ipdir = '..'
45 ipdir = pjoin(os.path.dirname(__file__), os.pardir)
46 46
47 47 ipdir = os.path.abspath(ipdir)
48 48
49 49 cd(ipdir)
50 50 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
51 51 raise SystemExit('Invalid ipython directory: %s' % ipdir)
52 52 return ipdir
53 53
54 54
55 55 def compile_tree():
56 56 """Compile all Python files below current directory."""
57 57 stat = os.system('python -m compileall .')
58 58 if stat:
59 59 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
60 60 msg += 'See messages above for the actual file that produced it.\n'
61 61 raise SystemExit(msg)
General Comments 0
You need to be logged in to leave comments. Login now