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