##// END OF EJS Templates
Put build cmds in a single place to minimize repetition errors.
Fernando Perez -
Show More
@@ -1,39 +1,39 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
6
7 from toollib import *
7 from toollib import *
8
8
9 # Get main ipython dir, this will raise if it doesn't pass some checks
9 # Get main ipython dir, this will raise if it doesn't pass some checks
10 ipdir = get_ipdir()
10 ipdir = get_ipdir()
11 cd(ipdir)
11 cd(ipdir)
12
12
13 # Load release info
13 # Load release info
14 execfile(pjoin('IPython', 'core', 'release.py'))
14 execfile(pjoin('IPython', 'core', 'release.py'))
15
15
16 # Check that everything compiles
16 # Check that everything compiles
17 compile_tree()
17 compile_tree()
18
18
19 # Cleanup
19 # Cleanup
20 for d in ['build', 'dist', pjoin('docs', 'build'), pjoin('docs', 'dist'),
20 for d in ['build', 'dist', pjoin('docs', 'build'), pjoin('docs', 'dist'),
21 pjoin('docs', 'source', 'api', 'generated')]:
21 pjoin('docs', 'source', 'api', 'generated')]:
22 if os.path.isdir(d):
22 if os.path.isdir(d):
23 remove_tree(d)
23 remove_tree(d)
24
24
25 # Build source and binary distros
25 # Build source and binary distros
26 sh('./setup.py sdist --formats=gztar,zip')
26 sh(sdists)
27
27
28 # Build eggs
28 # Build eggs
29 sh('python ./setupegg.py bdist_egg')
29 sh(eggs)
30
30
31 # Run windows builds
31 # Run windows builds
32 map(sh, win_builds)
32 map(sh, win_builds)
33
33
34 # Change name so retarded Vista runs the installer correctly
34 # Change name so retarded Vista runs the installer correctly
35 sh("rename 's/linux-i686/win32/' dist/*.exe")
35 sh("rename 's/linux-i686/win32/' dist/*.exe")
36 sh("rename 's/linux-x86_64/win32/' dist/*.exe")
36 sh("rename 's/linux-x86_64/win32/' dist/*.exe")
37 sh("rename 's/amd64/amd64-setup/' dist/*.exe")
37 sh("rename 's/amd64/amd64-setup/' dist/*.exe")
38 # exe files aren't really executable under *nix.
38 # exe files aren't really executable under *nix.
39 sh("chmod -x dist/*.exe")
39 sh("chmod -x dist/*.exe")
@@ -1,66 +1,65 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
9
10 # 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
11 ipdir = get_ipdir()
11 ipdir = get_ipdir()
12 tooldir = pjoin(ipdir, 'tools')
12 tooldir = pjoin(ipdir, 'tools')
13 distdir = pjoin(ipdir, 'dist')
13 distdir = pjoin(ipdir, 'dist')
14
14
15 # Where I keep static backups of each release
15 # Where I keep static backups of each release
16 ipbackupdir = os.path.expanduser('~/ipython/backup')
16 ipbackupdir = os.path.expanduser('~/ipython/backup')
17
17
18 # Start in main IPython dir
18 # Start in main IPython dir
19 cd(ipdir)
19 cd(ipdir)
20
20
21 # Load release info
21 # Load release info
22 execfile(pjoin('IPython','core','release.py'))
22 execfile(pjoin('IPython','core','release.py'))
23
23
24 # Build site addresses for file uploads
24 # Build site addresses for file uploads
25 release_site = '%s/release/%s' % (archive, version)
25 release_site = '%s/release/%s' % (archive, version)
26 backup_site = '%s/backup/' % archive
26 backup_site = '%s/backup/' % archive
27
27
28 # Start actual release process
28 # Start actual release process
29 print()
29 print()
30 print('Releasing IPython')
30 print('Releasing IPython')
31 print('=================')
31 print('=================')
32 print()
32 print()
33 print('Version:', version)
33 print('Version:', version)
34 print()
34 print()
35 print('Source IPython directory:', ipdir)
35 print('Source IPython directory:', ipdir)
36 print()
36 print()
37
37
38 # Perform local backup, go to tools dir to run it.
38 # Perform local backup, go to tools dir to run it.
39 cd(tooldir)
39 cd(tooldir)
40 sh('./make_tarball.py')
40 sh('./make_tarball.py')
41 sh('mv ipython-*.tgz %s' % ipbackupdir)
41 sh('mv ipython-*.tgz %s' % ipbackupdir)
42
42
43 # Build release files
43 # Build release files
44 sh('./build_release %s' % ipdir)
44 sh('./build_release %s' % ipdir)
45
45
46 # Register with the Python Package Index (PyPI)
46 # Register with the Python Package Index (PyPI)
47 print( 'Registering with PyPI...')
47 print( 'Registering with PyPI...')
48 cd(ipdir)
48 cd(ipdir)
49 sh('./setup.py register')
49 sh('./setup.py register')
50
50
51 # Upload all files
51 # Upload all files
52 sh('./setup.py sdist --formats=gztar,zip upload')
52 for cmd in [sdists, eggs] + win_builds:
53 for wb in win_builds:
53 sh(cmd + ' upload')
54 sh(wb + ' upload')
55 cd(distdir)
54 cd(distdir)
56 print( 'Uploading distribution files...')
55 print( 'Uploading distribution files...')
57
56
58 # Make target dir if it doesn't exist
57 # Make target dir if it doesn't exist
59 sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version))
58 sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version))
60 sh('scp * %s' % release_site)
59 sh('scp * %s' % release_site)
61
60
62 print( 'Uploading backup files...')
61 print( 'Uploading backup files...')
63 cd(ipbackupdir)
62 cd(ipbackupdir)
64 sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site)
63 sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site)
65
64
66 print('Done!')
65 print('Done!')
@@ -1,72 +1,78 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 # Commands for Windows builds.
22 # Build commands
23 # Source dists
24 sdists = './setup.py sdist --formats=gztar,zip'
25 # Eggs
26 eggs = './setupegg.py bdist_egg'
27
28 # Windows builds.
23 # We do them separately, so that the extra Windows scripts don't get pulled
29 # We do them separately, so that the extra Windows scripts don't get pulled
24 # into Unix builds (setup.py has code which checks for bdist_wininst). Note
30 # into Unix builds (setup.py has code which checks for bdist_wininst). Note
25 # that the install scripts args are added to the main distutils call in
31 # that the install scripts args are added to the main distutils call in
26 # setup.py, so they don't need to be passed here.
32 # setup.py, so they don't need to be passed here.
27 #
33 #
28 # The Windows 64-bit installer can't be built by a Linux/Mac Python because ofa
34 # The Windows 64-bit installer can't be built by a Linux/Mac Python because ofa
29 # bug in distutils: http://bugs.python.org/issue6792.
35 # bug in distutils: http://bugs.python.org/issue6792.
30 # So we have to build it with a wine-installed native Windows Python...
36 # So we have to build it with a wine-installed native Windows Python...
31 win_builds = ["python setup.py bdist_wininst",
37 win_builds = ["python setup.py bdist_wininst",
32 r"%s/.wine/dosdevices/c\:/Python27/python.exe setup.py build "
38 r"%s/.wine/dosdevices/c\:/Python27/python.exe setup.py build "
33 "--plat-name=win-amd64 bdist_wininst "
39 "--plat-name=win-amd64 bdist_wininst "
34 "--install-script=ipython_win_post_install.py" %
40 "--install-script=ipython_win_post_install.py" %
35 os.environ['HOME'] ]
41 os.environ['HOME'] ]
36
42
37 # Utility functions
43 # Utility functions
38 def sh(cmd):
44 def sh(cmd):
39 """Run system command in shell, raise SystemExit if it returns an error."""
45 """Run system command in shell, raise SystemExit if it returns an error."""
40 print("$", cmd)
46 print("$", cmd)
41 stat = os.system(cmd)
47 stat = os.system(cmd)
42 #stat = 0 # Uncomment this and comment previous to run in debug mode
48 #stat = 0 # Uncomment this and comment previous to run in debug mode
43 if stat:
49 if stat:
44 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
50 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
45
51
46 # Backwards compatibility
52 # Backwards compatibility
47 c = sh
53 c = sh
48
54
49 def get_ipdir():
55 def get_ipdir():
50 """Get IPython directory from command line, or assume it's the one above."""
56 """Get IPython directory from command line, or assume it's the one above."""
51
57
52 # Initialize arguments and check location
58 # Initialize arguments and check location
53 try:
59 try:
54 ipdir = sys.argv[1]
60 ipdir = sys.argv[1]
55 except IndexError:
61 except IndexError:
56 ipdir = '..'
62 ipdir = '..'
57
63
58 ipdir = os.path.abspath(ipdir)
64 ipdir = os.path.abspath(ipdir)
59
65
60 cd(ipdir)
66 cd(ipdir)
61 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
67 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
62 raise SystemExit('Invalid ipython directory: %s' % ipdir)
68 raise SystemExit('Invalid ipython directory: %s' % ipdir)
63 return ipdir
69 return ipdir
64
70
65
71
66 def compile_tree():
72 def compile_tree():
67 """Compile all Python files below current directory."""
73 """Compile all Python files below current directory."""
68 stat = os.system('python -m compileall .')
74 stat = os.system('python -m compileall .')
69 if stat:
75 if stat:
70 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
76 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
71 msg += 'See messages above for the actual file that produced it.\n'
77 msg += 'See messages above for the actual file that produced it.\n'
72 raise SystemExit(msg)
78 raise SystemExit(msg)
General Comments 0
You need to be logged in to leave comments. Login now