##// END OF EJS Templates
Update release-related tools, make more py3k-friendly.
Fernando Perez -
Show More
@@ -1,52 +1,63 b''
1 1 #!/usr/bin/env python
2 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 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 tooldir = pjoin(ipdir,'tools')
12 distdir = pjoin(ipdir,'dist')
12 tooldir = pjoin(ipdir, 'tools')
13 distdir = pjoin(ipdir, 'dist')
14
13 15 # Where I keep static backups of each release
14 16 ipbackupdir = os.path.expanduser('~/ipython/backup')
15 17
18 # SSH root address of the archive site
19 archive = 'ipython@archive.ipython.org:archive.ipython.org'
16 20 # Start in main IPython dir
17 21 cd(ipdir)
18 22
19 23 # Load release info
20 24 execfile(pjoin('IPython','core','release.py'))
21 25
22 print
23 print "Releasing IPython"
24 print "================="
25 print
26 print 'Source IPython directory:', ipdir
27 print
26 # Build site addresses for file uploads
27 release_site = '%s/release/%s' % (archive, version)
28 backup_site = '%s/backup/%s' % (archive, version)
29
30 # Start actual release process
31 print()
32 print('Releasing IPython')
33 print('=================')
34 print()
35 print('Version:', version)
36 print()
37 print('Source IPython directory:', ipdir)
38 print()
28 39
29 40 # Perform local backup, go to tools dir to run it.
30 41 cd(tooldir)
31 c('./make_tarball.py')
32 c('mv ipython-*.tgz %s' % ipbackupdir)
42 sh('./make_tarball.py')
43 sh('mv ipython-*.tgz %s' % ipbackupdir)
33 44
34 45 # Build release files
35 c('./build_release %s' % ipdir)
46 sh('./build_release %s' % ipdir)
36 47
37 48 # Register with the Python Package Index (PyPI)
38 print "Registering with PyPI..."
49 print( 'Registering with PyPI...')
39 50 cd(ipdir)
40 c('./setup.py register')
51 sh('./setup.py register')
41 52
42 53 # Upload all files
43 c('./setup.py sdist --formats=gztar,zip upload')
54 sh('./setup.py sdist --formats=gztar,zip upload')
44 55 cd(distdir)
45 print "Uploading distribution files..."
46 c('scp * ipython@ipython.scipy.org:www/dist/')
56 print( 'Uploading distribution files...')
57 sh('scp * %s' % release_site)
47 58
48 print "Uploading backup files..."
59 print( 'Uploading backup files...')
49 60 cd(ipbackupdir)
50 c('scp `ls -1tr *tgz | tail -1` ipython@ipython.scipy.org:www/backup/')
61 sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site)
51 62
52 print "Done!"
63 print('Done!')
@@ -1,48 +1,50 b''
1 1 """Various utilities common to IPython release and maintenance tools.
2 2 """
3 from __future__ import print_function
4
3 5 # Library imports
4 6 import os
5 7 import sys
6 8
7 9 from distutils.dir_util import remove_tree
8 10
9 11 # Useful shorthands
10 12 pjoin = os.path.join
11 13 cd = os.chdir
12 14
13 15 # Utility functions
14 16 def sh(cmd):
15 17 """Run system command in shell, raise SystemExit if it returns an error."""
16 print "$",cmd
18 print("$", cmd)
17 19 stat = os.system(cmd)
18 20 #stat = 0 # Uncomment this and comment previous to run in debug mode
19 21 if stat:
20 22 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
21 23
22 24 # Backwards compatibility
23 25 c = sh
24 26
25 27 def get_ipdir():
26 28 """Get IPython directory from command line, or assume it's the one above."""
27 29
28 30 # Initialize arguments and check location
29 31 try:
30 32 ipdir = sys.argv[1]
31 33 except IndexError:
32 34 ipdir = '..'
33 35
34 36 ipdir = os.path.abspath(ipdir)
35 37
36 38 cd(ipdir)
37 39 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
38 40 raise SystemExit('Invalid ipython directory: %s' % ipdir)
39 41 return ipdir
40 42
41 43
42 44 def compile_tree():
43 45 """Compile all Python files below current directory."""
44 46 stat = os.system('python -m compileall .')
45 47 if stat:
46 48 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
47 49 msg += 'See messages above for the actual file that produced it.\n'
48 50 raise SystemExit(msg)
General Comments 0
You need to be logged in to leave comments. Login now