6 import os, platform, re, shutil
10 Import(
'MYAPP_VER_MAJOR')
11 Import(
'MYAPP_VER_MINOR')
12 Import(
'MYAPP_VER_COMPILATION')
13 Import(
'WEB_SRV_PREFIX WEB_SRV_HOST WEB_SRV_PORT WEB_CLIENT_HOST WEB_CLIENT_PORT')
14 Import(
'DB_NAME DB_USER DB_PASSWORD')
16 def build_websrv_version( target, source, env):
17 file=open(str(target[0]),
'w')
18 file.write(
'web_srv_prefix = "' + WEB_SRV_PREFIX +
'"\n')
19 file.write(
'major = ' + MYAPP_VER_MAJOR +
'\n')
20 file.write(
'minor = "' + MYAPP_VER_MINOR +
'"\n')
21 file.write(
'compilation = ' + MYAPP_VER_COMPILATION +
'\n')
22 file.write(
'DB_NAME = "' + DB_NAME +
'"\n')
23 file.write(
'DB_USER = "' + DB_USER +
'"\n')
24 file.write(
'DB_PASSWORD = "' + DB_PASSWORD +
'"\n')
29 out_dir =
'../build_web/'
30 file_ver_name = out_dir +
'version/version_gen.py'
31 env.Command(file_ver_name, [], build_websrv_version )
35 for root, dirs, files
in os.walk(app_src):
36 p = os.path.relpath(root, app_src)
38 filename = os.path.join(root, name)
39 inst_file = env.Install(out_dir + p, filename)
40 if re.match(
'.*\.py$', filename):
41 pyc = env.File( str(filename) +
'c' )
42 env.SideEffect( pyc, inst_file)
45 env.Clean(
'.',out_dir)