-
Notifications
You must be signed in to change notification settings - Fork 135
/
SConstruct
88 lines (67 loc) · 2.09 KB
/
SConstruct
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import os
import re
import subprocess
import tarfile
# Requirements
# * Python
# * PyLint
# * PyChecker
# * PyFlakes
# * Nose
###################
# Builders
###################
def build_lint(target, source, env):
args = ['pylint', '--reports=n', '--disable=C0103']
args.extend([str(py) for py in source])
return subprocess.call(args)
bld_lint = Builder(action=build_lint)
def build_check(target, source, env):
args = ['pychecker']
args.extend([str(py) for py in source])
return subprocess.call(args)
bld_check = Builder(action=build_check)
def build_test(target, source, env):
args = ['nosetests', '--all-modules', 'core', 'parser', 'writer']
return subprocess.call(args)
bld_test = Builder(action=build_test)
###################
# Filters
###################
source_re = re.compile(r'.*\.py$')
def filter_source(arg, top, names):
for name in names:
if source_re.match(os.path.join(top, name)):
arg.append(File(os.path.join(top, name)))
test_re = re.compile(r'.*/(t|test)/.*_t\.py$')
def filter_test(arg, top, names):
for name in names:
if test_re.match(os.path.join(top, name)):
arg.append(File(os.path.join(top, name)))
###################
# File Lists
###################
all_source = []
os.path.walk('.', filter_source, all_source)
all_tests = []
os.path.walk('.', filter_test, all_tests)
parser_tests = []
os.path.walk('./parser', filter_test, parser_tests)
writer_tests = []
os.path.walk('./writer', filter_test, writer_tests)
###################
# Environment
###################
env = Environment(BUILDERS = {'test': bld_test,
'lint': bld_lint,
'check': bld_check,
},
ENV = {'PATH' : os.environ['PATH']},
tools = ['default'])
lint = env.lint(['fake_target_to_force_lint'], all_source)
check = env.check(['fake_target_to_force_check'], all_source)
test = env.test(['fake_target_to_force_test'], all_tests)
env.Alias('lint', lint)
env.Alias('check', check)
env.Alias('test', test)
env.Alias('all', '.')