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