##// 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 #!/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,61 +1,61 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 # Useful shorthands
9 # Useful shorthands
10 pjoin = os.path.join
10 pjoin = os.path.join
11 cd = os.chdir
11 cd = os.chdir
12
12
13 # Constants
13 # Constants
14
14
15 # SSH root address of the archive site
15 # SSH root address of the archive site
16 archive_user = 'ipython@archive.ipython.org'
16 archive_user = 'ipython@archive.ipython.org'
17 archive_dir = 'archive.ipython.org'
17 archive_dir = 'archive.ipython.org'
18 archive = '%s:%s' % (archive_user, archive_dir)
18 archive = '%s:%s' % (archive_user, archive_dir)
19
19
20 # Build commands
20 # Build commands
21 # Source dists
21 # Source dists
22 sdists = './setup.py sdist --formats=gztar,zip'
22 sdists = './setup.py sdist --formats=gztar,zip'
23 # Binary dists
23 # Binary dists
24 wheels = './setupegg.py bdist_wheel'
24 wheels = './setupegg.py bdist_wheel'
25
25
26 # Utility functions
26 # Utility functions
27 def sh(cmd):
27 def sh(cmd):
28 """Run system command in shell, raise SystemExit if it returns an error."""
28 """Run system command in shell, raise SystemExit if it returns an error."""
29 print("$", cmd)
29 print("$", cmd)
30 stat = os.system(cmd)
30 stat = os.system(cmd)
31 #stat = 0 # Uncomment this and comment previous to run in debug mode
31 #stat = 0 # Uncomment this and comment previous to run in debug mode
32 if stat:
32 if stat:
33 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
33 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
34
34
35 # Backwards compatibility
35 # Backwards compatibility
36 c = sh
36 c = sh
37
37
38 def get_ipdir():
38 def get_ipdir():
39 """Get IPython directory from command line, or assume it's the one above."""
39 """Get IPython directory from command line, or assume it's the one above."""
40
40
41 # Initialize arguments and check location
41 # Initialize arguments and check location
42 try:
42 try:
43 ipdir = sys.argv[1]
43 ipdir = sys.argv[1]
44 except IndexError:
44 except IndexError:
45 ipdir = '..'
45 ipdir = pjoin(os.path.dirname(__file__), os.pardir)
46
46
47 ipdir = os.path.abspath(ipdir)
47 ipdir = os.path.abspath(ipdir)
48
48
49 cd(ipdir)
49 cd(ipdir)
50 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
50 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
51 raise SystemExit('Invalid ipython directory: %s' % ipdir)
51 raise SystemExit('Invalid ipython directory: %s' % ipdir)
52 return ipdir
52 return ipdir
53
53
54
54
55 def compile_tree():
55 def compile_tree():
56 """Compile all Python files below current directory."""
56 """Compile all Python files below current directory."""
57 stat = os.system('python -m compileall .')
57 stat = os.system('python -m compileall .')
58 if stat:
58 if stat:
59 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
59 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
60 msg += 'See messages above for the actual file that produced it.\n'
60 msg += 'See messages above for the actual file that produced it.\n'
61 raise SystemExit(msg)
61 raise SystemExit(msg)
General Comments 0
You need to be logged in to leave comments. Login now