Belle II Software  release-08-01-10
output.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 from SCons.Script import GetOption
13 
14 # compile: blue
15 # link : green
16 # install: purple
17 # copy : purple
18 # map : cyan
19 # dict : yellow
20 # doc : gray
21 # cleanup: black/white
22 # strip : black/white
23 
24 color_map_none = {
25  'end': '',
26  'compile': '',
27  'link': '',
28  'install': '',
29  'copy': '',
30  'map': '',
31  'dict': '',
32  'doc': '',
33  'cleanup': '',
34  'strip': '',
35 }
36 color_map_light = {
37  'end': '\033[0m',
38  'compile': '\033[94m',
39  'link': '\033[92m',
40  'install': '\033[95m',
41  'copy': '\033[95m',
42  'map': '\033[96m',
43  'dict': '\033[93m',
44  'doc': '\033[37m',
45  'cleanup': '\033[37m',
46  'strip': '\033[37m',
47 }
48 color_map_dark = {
49  'end': '\033[0m',
50  'compile': '\033[2m\033[34m',
51  'link': '\033[2m\033[32m',
52  'install': '\033[2m\033[35m',
53  'copy': '\033[2m\033[35m',
54  'map': '\033[2m\033[36m',
55  'dict': '\033[2m\033[33m',
56  'doc': '\033[90m',
57  'cleanup': '\033[30m',
58  'strip': '\033[30m',
59 }
60 
61 
62 def generate(env):
63  color_map = color_map_none
64  if GetOption('color') == 'light':
65  color_map = color_map_light
66  elif GetOption('color') == 'dark':
67  color_map = color_map_dark
68 
69  if not GetOption('verbose'):
70  if GetOption('no-symlink'):
71  install_text = 'installing'
72  else:
73  install_text = 'symlinking'
74  env.Replace(
75  SHCXXCOMSTR='${CXXCOMSTR}',
76  CXXCOMSTR=color_map['compile'] + '*** compiling : ${SOURCE}' + color_map['end'],
77  FORTRANPPCOMSTR='${CXXCOMSTR}',
78  SHFORTRANPPCOMSTR='${CXXCOMSTR}',
79  CCCOMSTR='${CXXCOMSTR}',
80  SHCCCOMSTR='${CXXCOMSTR}',
81  SHLINKCOMSTR='${LINKCOMSTR}',
82  LINKCOMSTR=color_map['link'] + '*** linking : ${TARGET}' + color_map['end'],
83  INSTALLSTR=color_map['install'] + '*** ' + install_text + ' : ${TARGET}' + color_map['end'],
84  COPYCOMSTR=color_map['copy'] + '*** copying : ${TARGET}' + color_map['end'],
85  MAPCOMSTR=color_map['map'] + '*** map : ${TARGET}' + color_map['end'],
86  ROOTCLINGCOMSTR=color_map['dict'] + '*** dictionary : ${TARGET}' + color_map['end'],
87  CLASSVERSIONCOMSTR=color_map['dict'] + '*** checking : ${SOURCE}' + color_map['end'],
88  MODULEIOCOMSTR=color_map['doc'] + '*** module-io : ${TARGET}' + color_map['end'],
89  DOXYGENCOMSTR=color_map['doc'] + '*** doxygen : ${TARGET}' + color_map['end'],
90  STRIPCOMSTR=color_map['strip'] + '*** stripping : ${TARGET}' + color_map['end'],
91  )
92 
93  env['CLEANUPCOMSTR'] = color_map['cleanup'] + '*** removing : %s' \
94  + color_map['end']
95 
96 
97 def exists(env):
98  return True