File: wb_pychecker.py

package info (click to toggle)
svn-workbench 1.5.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,400 kB
  • ctags: 1,585
  • sloc: python: 12,163; sh: 74; makefile: 46; ansic: 9
file content (32 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (7)
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
#
#   wb_pychecker.py
#
#   helper to run pychecker on all the imports of workbench
#
import os
import sys
sys.path.insert( 0, os.environ['PYCHECKER_DIR'] )

class CountOutput:
    def __init__( self, f ):
        self.__f = f
        self.__write_count = 0
    def write( self, data ):
        self.__write_count += data.count('\n')
        return self.__f.write( data )

    def getWriteCount( self ):
        return self.__write_count

def report():
    count = sys.__stdout__.getWriteCount()
    print 'Info: %d lines' % count
    sys.exit( count != 0 )

os.environ['PYCHECKER'] = '--no-shadowbuiltin --config=./pycheckrc'
import pychecker.checker

sys.__stdout__ = CountOutput( sys.__stdout__ )
sys.stdout = sys.__stdout__

import wb_main