bioweb  0.09.92
C++/Python(django)/JavaScript(angularJS) framework
SConscript
Go to the documentation of this file.
1 # -*- mode: Python; -*- scons script
2 
3 ## @file web/SConscript
4 # @brief scons build for server part (Python django)
5 
6 import os, platform, re, shutil
7 
8 Import('env')
9 
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')
15 
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')
25 
26  file.close()
27  return
28 
29 out_dir = '../build_web/'
30 file_ver_name = out_dir + 'version/version_gen.py'
31 env.Command(file_ver_name, [], build_websrv_version )
32 
33 #install web
34 app_src = '../web'
35 for root, dirs, files in os.walk(app_src):
36  p = os.path.relpath(root, app_src) #relative path
37  for name in files:
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)
43 
44 
45 env.Clean('.',out_dir)
46