-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSConstruct
86 lines (76 loc) · 3.03 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
import sys, os.path, os
sys.path += [os.path.abspath(os.path.join(os.getcwd(), os.pardir)) + '/yyagl']
sys.path.append('..')
from os import getcwd
from collections import namedtuple
from build.build import extensions, files, img_tgt_names, \
set_path, src_fpath, devinfo_fpath, docs_fpath, pdf_fpath
from build.src import bld_src
from build.devinfo import bld_devinfo
from build.docs import bld_docs
from build.imgs import bld_images
from build.pdf import bld_pdfs
from build.uml import bld_uml
SCONS_ENABLE_VIRTUALENV=1
argument_info = [ # (argname, default value)
('path', 'built'), ('source', 0), ('devinfo', 0),
('docs', 0), ('pdf', 0), ('cores', 0), ('uml', 0)]
args = {arg: ARGUMENTS.get(arg, default) for (arg, default) in argument_info}
path = set_path(args['path'])
app_name = 'yracing'
pargs = {'dst_dir': path, 'appname': app_name}
src_path = src_fpath.format(**pargs)
devinfo_path = devinfo_fpath.format(**pargs)
docs_path = docs_fpath.format(**pargs)
pdf_path = pdf_fpath.format(**pargs)
bld_src = Builder(action=bld_src)
bld_devinfo = Builder(action=bld_devinfo)
bld_docs = Builder(action=bld_docs)
bld_pdfs = Builder(action=bld_pdfs)
bld_uml = Builder(action=bld_uml)
env = Environment(BUILDERS={
'source': bld_src, 'devinfo': bld_devinfo,
'docs': bld_docs, 'pdf': bld_pdfs, 'uml': bld_uml})
env['APPNAME'] = app_name
env['CORES'] = int(args['cores'])
PDFInfo = namedtuple('PDFInfo', 'lng root fil excl')
racing_fil = ['./game/*', './car/*',
'./race/*', './track/*']
racing_lst = [PDFInfo('python', '.', '*.py', racing_fil)]
binfo_lst = [
('python', '*.py *.pdef'), ('lua', 'config.lua'),
('', '*.rst *.css_t *.conf'), ('html', '*.html'), ('javascript', '*.js')]
build_lst = [PDFInfo(binfo[0], 'build', binfo[1], [])
for binfo in binfo_lst]
pdf_conf = {
'yracing': racing_lst,
'yracing_car': [PDFInfo('python', './car', '*.py', [])],
'yracing_race': [PDFInfo('python', './race', '*.py', [])],
'yracing_track': [PDFInfo('python', './track', '*.py', [])]}
env['PDF_CONF'] = pdf_conf
cond_racing = lambda s: not str(s).startswith('yyagl/racing/')
def cond_yyagl(src):
#not_yyagl = not str(src).startswith('yyagl/')
thirdparty = str(src).startswith('yyagl/thirdparty/')
venv = str(src).startswith('venv/')
racing = str(src).startswith('yyagl/racing/')
return thirdparty or venv or racing or \
str(src).startswith('yyagl/tests')
dev_conf = {'devinfo_yyagl': cond_yyagl}
env['DEV_CONF'] = dev_conf
env['UML_FILTER'] = []
env['DOCS_PATH'] = getcwd() + '/..'
VariantDir(path, '.')
general_src = files(extensions, ['built'])
if args['source']:
env.source([src_path], general_src)
if args['devinfo']:
env.devinfo([devinfo_path], files(['py'], ['venv', 'thirdparty']))
if args['docs']:
env.docs([docs_path], files(['py'], ['venv', 'thirdparty']))
if args['pdf']:
env.pdf([pdf_path], files(['py'], ['venv', 'thirdparty']))
if args['uml']:
env.uml(
['built/uml_classes.zip', 'assets/uml/class_diagram.png'],
general_src + ['assets/uml/class_diagram.txt'])