Show More
@@ -1,32 +1,29 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | """IPython release build script. |
|
2 | """IPython release build script. | |
3 | """ |
|
3 | """ | |
4 | import os |
|
4 | import os | |
5 | from shutil import rmtree |
|
5 | from shutil import rmtree | |
6 |
|
6 | |||
7 |
from toollib import sh, pjoin, get_ipdir, cd, |
|
7 | from toollib import sh, pjoin, get_ipdir, cd, execfile, sdists, buildwheels | |
8 |
|
8 | |||
9 | def build_release(): |
|
9 | def build_release(): | |
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 | cd(ipdir) |
|
13 | cd(ipdir) | |
14 |
|
14 | |||
15 | # Load release info |
|
15 | # Load release info | |
16 | execfile(pjoin('IPython', 'core', 'release.py'), globals()) |
|
16 | execfile(pjoin('IPython', 'core', 'release.py'), globals()) | |
17 |
|
17 | |||
18 | # Check that everything compiles |
|
|||
19 | compile_tree('*') |
|
|||
20 |
|
||||
21 | # Cleanup |
|
18 | # Cleanup | |
22 | for d in ['build', 'dist', pjoin('docs', 'build'), pjoin('docs', 'dist'), |
|
19 | for d in ['build', 'dist', pjoin('docs', 'build'), pjoin('docs', 'dist'), | |
23 | pjoin('docs', 'source', 'api', 'generated')]: |
|
20 | pjoin('docs', 'source', 'api', 'generated')]: | |
24 | if os.path.isdir(d): |
|
21 | if os.path.isdir(d): | |
25 | rmtree(d) |
|
22 | rmtree(d) | |
26 |
|
23 | |||
27 | # Build source and binary distros |
|
24 | # Build source and binary distros | |
28 | sh(sdists) |
|
25 | sh(sdists) | |
29 | buildwheels() |
|
26 | buildwheels() | |
30 |
|
27 | |||
31 | if __name__ == '__main__': |
|
28 | if __name__ == '__main__': | |
32 | build_release() |
|
29 | build_release() |
@@ -1,66 +1,57 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 |
|
7 | |||
8 | # Useful shorthands |
|
8 | # Useful shorthands | |
9 | pjoin = os.path.join |
|
9 | pjoin = os.path.join | |
10 | cd = os.chdir |
|
10 | cd = os.chdir | |
11 |
|
11 | |||
12 | # Constants |
|
12 | # Constants | |
13 |
|
13 | |||
14 | # SSH root address of the archive site |
|
14 | # SSH root address of the archive site | |
15 | archive_user = 'ipython@archive.ipython.org' |
|
15 | archive_user = 'ipython@archive.ipython.org' | |
16 | archive_dir = 'archive.ipython.org' |
|
16 | archive_dir = 'archive.ipython.org' | |
17 | archive = '%s:%s' % (archive_user, archive_dir) |
|
17 | archive = '%s:%s' % (archive_user, archive_dir) | |
18 |
|
18 | |||
19 | # Build commands |
|
19 | # Build commands | |
20 | # Source dists |
|
20 | # Source dists | |
21 | sdists = './setup.py sdist --formats=gztar,zip' |
|
21 | sdists = './setup.py sdist --formats=gztar,zip' | |
22 | # Binary dists |
|
22 | # Binary dists | |
23 | def buildwheels(): |
|
23 | def buildwheels(): | |
24 | for py in ('2', '3'): |
|
24 | for py in ('2', '3'): | |
25 | sh('python%s setupegg.py bdist_wheel' % py) |
|
25 | sh('python%s setupegg.py bdist_wheel' % py) | |
26 |
|
26 | |||
27 | # Utility functions |
|
27 | # Utility functions | |
28 | def sh(cmd): |
|
28 | def sh(cmd): | |
29 | """Run system command in shell, raise SystemExit if it returns an error.""" |
|
29 | """Run system command in shell, raise SystemExit if it returns an error.""" | |
30 | print("$", cmd) |
|
30 | print("$", cmd) | |
31 | stat = os.system(cmd) |
|
31 | stat = os.system(cmd) | |
32 | #stat = 0 # Uncomment this and comment previous to run in debug mode |
|
32 | #stat = 0 # Uncomment this and comment previous to run in debug mode | |
33 | if stat: |
|
33 | if stat: | |
34 | raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) |
|
34 | raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) | |
35 |
|
35 | |||
36 | # Backwards compatibility |
|
36 | # Backwards compatibility | |
37 | c = sh |
|
37 | c = sh | |
38 |
|
38 | |||
39 | def get_ipdir(): |
|
39 | def get_ipdir(): | |
40 | """Get IPython directory from command line, or assume it's the one above.""" |
|
40 | """Get IPython directory from command line, or assume it's the one above.""" | |
41 |
|
41 | |||
42 | # Initialize arguments and check location |
|
42 | # Initialize arguments and check location | |
43 | ipdir = pjoin(os.path.dirname(__file__), os.pardir) |
|
43 | ipdir = pjoin(os.path.dirname(__file__), os.pardir) | |
44 |
|
44 | |||
45 | ipdir = os.path.abspath(ipdir) |
|
45 | ipdir = os.path.abspath(ipdir) | |
46 |
|
46 | |||
47 | cd(ipdir) |
|
47 | cd(ipdir) | |
48 | if not os.path.isdir('IPython') and os.path.isfile('setup.py'): |
|
48 | if not os.path.isdir('IPython') and os.path.isfile('setup.py'): | |
49 | raise SystemExit('Invalid ipython directory: %s' % ipdir) |
|
49 | raise SystemExit('Invalid ipython directory: %s' % ipdir) | |
50 | return ipdir |
|
50 | return ipdir | |
51 |
|
51 | |||
52 |
|
||||
53 | def compile_tree(folder='.'): |
|
|||
54 | """Compile all Python files below current directory.""" |
|
|||
55 | stat = os.system('python -m compileall {}'.format(folder)) |
|
|||
56 | if stat: |
|
|||
57 | msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n' |
|
|||
58 | msg += 'See messages above for the actual file that produced it.\n' |
|
|||
59 | raise SystemExit(msg) |
|
|||
60 |
|
||||
61 | try: |
|
52 | try: | |
62 | execfile = execfile |
|
53 | execfile = execfile | |
63 | except NameError: |
|
54 | except NameError: | |
64 | def execfile(fname, globs, locs=None): |
|
55 | def execfile(fname, globs, locs=None): | |
65 | locs = locs or globs |
|
56 | locs = locs or globs | |
66 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) |
|
57 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) |
General Comments 0
You need to be logged in to leave comments.
Login now