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