Show More
@@ -1,23 +1,21 | |||
|
1 | 1 | #!/usr/bin/env python3 |
|
2 | 2 | """IPython release build script. |
|
3 | 3 | """ |
|
4 | 4 | import os |
|
5 | 5 | import sys |
|
6 | from shutil import rmtree | |
|
7 | 6 | |
|
8 |
from toollib import sh, |
|
|
7 | from toollib import sh, get_ipdir, cd, build_command | |
|
9 | 8 | |
|
10 | 9 | def build_release(): |
|
11 | 10 | |
|
12 | 11 | # Get main ipython dir, this will raise if it doesn't pass some checks |
|
13 | 12 | ipdir = get_ipdir() |
|
14 | 13 | cd(ipdir) |
|
15 | 14 | |
|
16 | 15 | # Build source and binary distros |
|
17 | sh(sdists) | |
|
18 | buildwheels() | |
|
16 | sh(build_command) | |
|
19 | 17 | # don't try to change, xz, bz2 deprecated. |
|
20 | 18 | sh(' '.join([sys.executable, 'tools/retar.py', 'dist/*.gz'])) |
|
21 | 19 | |
|
22 | 20 | if __name__ == '__main__': |
|
23 | 21 | build_release() |
@@ -1,51 +1,48 | |||
|
1 | 1 | """Various utilities common to IPython release and maintenance tools. |
|
2 | 2 | """ |
|
3 | 3 | |
|
4 | 4 | # Library imports |
|
5 | 5 | import os |
|
6 | 6 | import sys |
|
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 |
|
|
|
22 | # Binary dists | |
|
23 | def buildwheels(): | |
|
24 | sh("{python} -m build".format(python=sys.executable)) | |
|
21 | build_command = "{python} -m build".format(python=sys.executable) | |
|
25 | 22 | |
|
26 | 23 | |
|
27 | 24 | # Utility functions |
|
28 | 25 | def sh(cmd): |
|
29 | 26 | """Run system command in shell, raise SystemExit if it returns an error.""" |
|
30 | 27 | print("$", cmd) |
|
31 | 28 | stat = os.system(cmd) |
|
32 | 29 | #stat = 0 # Uncomment this and comment previous to run in debug mode |
|
33 | 30 | if stat: |
|
34 | 31 | raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) |
|
35 | 32 | |
|
36 | 33 | def get_ipdir(): |
|
37 | 34 | """Get IPython directory from command line, or assume it's the one above.""" |
|
38 | 35 | |
|
39 | 36 | # Initialize arguments and check location |
|
40 | 37 | ipdir = pjoin(os.path.dirname(__file__), os.pardir) |
|
41 | 38 | |
|
42 | 39 | ipdir = os.path.abspath(ipdir) |
|
43 | 40 | |
|
44 | 41 | cd(ipdir) |
|
45 | 42 | if not os.path.isdir('IPython') and os.path.isfile('setup.py'): |
|
46 | 43 | raise SystemExit('Invalid ipython directory: %s' % ipdir) |
|
47 | 44 | return ipdir |
|
48 | 45 | |
|
49 | 46 | def execfile(fname, globs, locs=None): |
|
50 | 47 | locs = locs or globs |
|
51 | 48 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) |
General Comments 0
You need to be logged in to leave comments.
Login now