Show More
@@ -1,56 +1,56 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 |
|
21 | sdists = './setup.py sdist --formats=gztar' | |
22 | # Binary dists |
|
22 | # Binary dists | |
23 | def buildwheels(): |
|
23 | def buildwheels(): | |
24 | sh('python3 setupegg.py bdist_wheel' % py) |
|
24 | sh('python3 setupegg.py bdist_wheel' % py) | |
25 |
|
25 | |||
26 | # Utility functions |
|
26 | # Utility functions | |
27 | def sh(cmd): |
|
27 | def sh(cmd): | |
28 | """Run system command in shell, raise SystemExit if it returns an error.""" |
|
28 | """Run system command in shell, raise SystemExit if it returns an error.""" | |
29 | print("$", cmd) |
|
29 | print("$", cmd) | |
30 | stat = os.system(cmd) |
|
30 | stat = os.system(cmd) | |
31 | #stat = 0 # Uncomment this and comment previous to run in debug mode |
|
31 | #stat = 0 # Uncomment this and comment previous to run in debug mode | |
32 | if stat: |
|
32 | if stat: | |
33 | raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) |
|
33 | raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) | |
34 |
|
34 | |||
35 | # Backwards compatibility |
|
35 | # Backwards compatibility | |
36 | c = sh |
|
36 | c = sh | |
37 |
|
37 | |||
38 | def get_ipdir(): |
|
38 | def get_ipdir(): | |
39 | """Get IPython directory from command line, or assume it's the one above.""" |
|
39 | """Get IPython directory from command line, or assume it's the one above.""" | |
40 |
|
40 | |||
41 | # Initialize arguments and check location |
|
41 | # Initialize arguments and check location | |
42 | ipdir = pjoin(os.path.dirname(__file__), os.pardir) |
|
42 | ipdir = pjoin(os.path.dirname(__file__), os.pardir) | |
43 |
|
43 | |||
44 | ipdir = os.path.abspath(ipdir) |
|
44 | ipdir = os.path.abspath(ipdir) | |
45 |
|
45 | |||
46 | cd(ipdir) |
|
46 | cd(ipdir) | |
47 | if not os.path.isdir('IPython') and os.path.isfile('setup.py'): |
|
47 | if not os.path.isdir('IPython') and os.path.isfile('setup.py'): | |
48 | raise SystemExit('Invalid ipython directory: %s' % ipdir) |
|
48 | raise SystemExit('Invalid ipython directory: %s' % ipdir) | |
49 | return ipdir |
|
49 | return ipdir | |
50 |
|
50 | |||
51 | try: |
|
51 | try: | |
52 | execfile = execfile |
|
52 | execfile = execfile | |
53 | except NameError: |
|
53 | except NameError: | |
54 | def execfile(fname, globs, locs=None): |
|
54 | def execfile(fname, globs, locs=None): | |
55 | locs = locs or globs |
|
55 | locs = locs or globs | |
56 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) |
|
56 | exec(compile(open(fname).read(), fname, "exec"), globs, locs) |
General Comments 0
You need to be logged in to leave comments.
Login now