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