File: pychecker_custom.py

package info (click to toggle)
boa-constructor 0.4.4cvs20050714-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 10,080 kB
  • ctags: 9,175
  • sloc: python: 56,189; sh: 545; makefile: 40
file content (36 lines) | stat: -rw-r--r-- 902 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from pychecker import Warning

warnings = []
class WarningWx(Warning.Warning) :
    """ Warning redirector """
    def output(self, stream=None) :
        warnings.append(`(self.file, self.line, self.err)`)

Warning.Warning = WarningWx


import sys

class NullFile :
    """ Output eater """
    def write(self, s) : sys.__stdout__.write(s)
    def flush(self): sys.__stdout__.flush()

sys.stderr = NullFile()


from pychecker import checker, Config

##import wxPythonNamespace
##_WXPYTHON_NAMESPACE = wxPythonNamespace.__dict__.keys()
##checker._DEFAULT_MODULE_TOKENS = list(checker._DEFAULT_MODULE_TOKENS)+ _WXPYTHON_NAMESPACE

if __name__ == '__main__' :
    try :
        exitcode = checker.main(sys.argv)
        sys.stderr = sys.__stderr__
        for warning in warnings:
            sys.stderr.write(warning+'\n')
        sys.exit(exitcode)
    except Config.UsageError :
        sys.exit(127)