annotate unixSoft/bin/epylint @ 336:ea73ef5dc38c

emacs: avoid weird package.el breakage with newish packages I've been toting around this package.el from 2009 or so, and something in the package format seems to have changed that broke me. Thanks to some related diagnostics by Lucas, I've grabbed the last package.el that worked with emacs 23 and stashed it here. This seems to work, modulo some things (notably js2-mode and smex) now seem to require emacs 24 if you install them using package.el, so this will end up being brittle on my last couple of emacs23 machines.
author Augie Fackler <raf@durin42.com>
date Thu, 29 May 2014 14:30:42 -0400
parents 7f67cf332537
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
93
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 import re
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 import sys
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 from subprocess import Popen, PIPE
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 p = Popen("pylint -f parseable -r n --disable-msg-cat=C,R %s" %
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 sys.argv[1], shell = True, stdout = PIPE).stdout
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 for line in p.readlines():
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11 match = re.search("\\[([WE])(, (.+?))?\\]", line)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 if match:
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13 kind = match.group(1)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 func = match.group(3)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15 if kind == "W":
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 msg = "Warning"
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 else:
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18 msg = "Error"
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 if func:
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 line = re.sub("\\[([WE])(, (.+?))?\\]",
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 "%s (%s):" % (msg, func), line)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 else:
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 line = re.sub("\\[([WE])?\\]", "%s:" % msg, line)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 print line,
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 p.close()