diff options
| author | Syohei YOSHIDA | 2016-11-16 23:16:15 +0900 |
|---|---|---|
| committer | Noam Postavsky | 2017-12-03 10:04:18 -0500 |
| commit | de68f337e36be7a40e5997ad6682770c42535c25 (patch) | |
| tree | f0bf75438fbf3895e89ae9db85bf3e883358da8e /modules/modhelp.py | |
| parent | afb04f7f3cb75c7c744d8fa8cd1cd70ad1755e6f (diff) | |
| download | emacs-de68f337e36be7a40e5997ad6682770c42535c25.tar.gz emacs-de68f337e36be7a40e5997ad6682770c42535c25.zip | |
modhelp.py: Support Python 3 (Bug#24954)
* modules/modhelp.py: 'print' statement was removed in Python
3. 'print' function should be used instead of 'print' statement.
Diffstat (limited to '')
| -rwxr-xr-x | modules/modhelp.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/modhelp.py b/modules/modhelp.py index 78fadda4126..9f8d3066062 100755 --- a/modules/modhelp.py +++ b/modules/modhelp.py | |||
| @@ -45,31 +45,31 @@ def cmd_test(args): | |||
| 45 | 45 | ||
| 46 | failed = [] | 46 | failed = [] |
| 47 | for m in mods: | 47 | for m in mods: |
| 48 | print '[*] %s: ------- start -------' % m | 48 | print('[*] %s: ------- start -------' % m) |
| 49 | print '[*] %s: running make' % m | 49 | print('[*] %s: running make' % m) |
| 50 | r = sp.call(make_cmd, cwd=m) | 50 | r = sp.call(make_cmd, cwd=m) |
| 51 | if r != 0: | 51 | if r != 0: |
| 52 | print '[E] %s: make failed' % m | 52 | print('[E] %s: make failed' % m) |
| 53 | failed += [m] | 53 | failed += [m] |
| 54 | continue | 54 | continue |
| 55 | 55 | ||
| 56 | print '[*] %s: running test' % m | 56 | print('[*] %s: running test' % m) |
| 57 | testpath = os.path.join(m, 'test.el') | 57 | testpath = os.path.join(m, 'test.el') |
| 58 | if os.path.isfile(testpath): | 58 | if os.path.isfile(testpath): |
| 59 | emacs_cmd = [EMACS, '-batch', '-L', '.', '-l', 'ert', | 59 | emacs_cmd = [EMACS, '-batch', '-L', '.', '-l', 'ert', |
| 60 | '-l', testpath, '-f', 'ert-run-tests-batch-and-exit'] | 60 | '-l', testpath, '-f', 'ert-run-tests-batch-and-exit'] |
| 61 | print ' '.join(emacs_cmd) | 61 | print(' '.join(emacs_cmd)) |
| 62 | r = sp.call(emacs_cmd) | 62 | r = sp.call(emacs_cmd) |
| 63 | if r != 0: | 63 | if r != 0: |
| 64 | print '[E] %s: test failed' % m | 64 | print('[E] %s: test failed' % m) |
| 65 | failed += [m] | 65 | failed += [m] |
| 66 | continue | 66 | continue |
| 67 | else: | 67 | else: |
| 68 | print '[W] %s: no test to run' % m | 68 | print('[W] %s: no test to run' % m) |
| 69 | 69 | ||
| 70 | print '\n[*] %d/%d MODULES OK' % (len(mods)-len(failed), len(mods)) | 70 | print('\n[*] %d/%d MODULES OK' % (len(mods)-len(failed), len(mods))) |
| 71 | for m in failed: | 71 | for m in failed: |
| 72 | print '\tfailed: %s' % m | 72 | print('\tfailed: %s' % m) |
| 73 | 73 | ||
| 74 | def to_lisp_sym(sym): | 74 | def to_lisp_sym(sym): |
| 75 | sym = re.sub('[_ ]', '-', sym) | 75 | sym = re.sub('[_ ]', '-', sym) |
| @@ -81,7 +81,7 @@ def to_c_sym(sym): | |||
| 81 | 81 | ||
| 82 | def cmd_init(args): | 82 | def cmd_init(args): |
| 83 | if os.path.exists(args.module): | 83 | if os.path.exists(args.module): |
| 84 | print "%s: file/dir '%s' already exists" % (__file__, args.module) | 84 | print("%s: file/dir '%s' already exists" % (__file__, args.module)) |
| 85 | return | 85 | return |
| 86 | 86 | ||
| 87 | os.mkdir(args.module) | 87 | os.mkdir(args.module) |
| @@ -98,10 +98,10 @@ def cmd_init(args): | |||
| 98 | if isinstance(path, string.Template): | 98 | if isinstance(path, string.Template): |
| 99 | path = path.substitute(template_vars) | 99 | path = path.substitute(template_vars) |
| 100 | path = os.path.join(args.module, path) | 100 | path = os.path.join(args.module, path) |
| 101 | print "writing %s..." % path | 101 | print("writing %s..." % path) |
| 102 | with open(path, "w+") as f: | 102 | with open(path, "w+") as f: |
| 103 | f.write(t.substitute(template_vars)) | 103 | f.write(t.substitute(template_vars)) |
| 104 | print "done! you can run %s test %s" % (__file__, args.module) | 104 | print("done! you can run %s test %s" % (__file__, args.module)) |
| 105 | 105 | ||
| 106 | 106 | ||
| 107 | def main(): | 107 | def main(): |