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