Gaudi Framework, version v25r0

Home   Generated: Mon Feb 17 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
gaudi-policy Namespace Reference

Classes

class  gen_conf
 
class  merge_confdb
 

Functions

def _gaudi_insert_blddir
 

 
def _gaudi_insert_project_level_pythonpath
 

 
def _gaudi_insert_project_level_joboptpath
 

 
def _gaudi_insert_project_level_datapath
 

 
def _gaudi_insert_project_level_xmlpath
 

 
def gaudi_install_python_modules
 

 
def gaudi_install_scripts
 

 
def gaudi_dictionary
 

 
def gaudi_install_joboptions
 

 
def gaudi_install_data
 

 
def gaudi_install_headers
 

 
def gaudi_qmtest
 

 
def gaudi_library
 

 
def gaudi_module
 

 
def gaudi_pyext
 

 
def gaudi_application
 

 
def schedule_gen_conf
 

 
def gen_conf_hook
 
def schedule_merge_confdb
 
def merge_confdb_hook
 
def gaudi_gen_package_version_header
 

Variables

 g_confdb_merger None
 

Function Documentation

def gaudi-policy._gaudi_insert_blddir (   self)
private


Definition at line 24 of file gaudi-policy.py.

24 
25 def _gaudi_insert_blddir(self):
26  self.env.prepend_value('INCPATHS', self.env.BUILD_INSTALL_AREA_INCDIR)
27  self.env.prepend_value('INCPATHS', '.')
28 
29  self.env.prepend_value('LIBPATH', self.env.BUILD_INSTALL_AREA_LIBDIR)
30  return
def gaudi-policy._gaudi_insert_project_level_datapath (   self)
private


insert_project_level_datapath adds ${INSTALL_AREA}/share into the
${DATAPATH} environment variable.

Definition at line 62 of file gaudi-policy.py.

62 
64  '''
65  insert_project_level_datapath adds ${INSTALL_AREA}/share into the
66  ${DATAPATH} environment variable.
67  '''
68  _get = getattr(self, 'hwaf_get_install_path', None)
69  if not _get: _get = getattr(self.bld, 'hwaf_get_install_path')
70  d = _get('${INSTALL_AREA}/share')
71  self.env.prepend_value('DATAPATH', d)
72  return
def gaudi-policy._gaudi_insert_project_level_joboptpath (   self)
private


insert_project_level_joboptpath adds ${INSTALL_AREA}/jobOptions into the
${JOBOPTSEARCHPATH} environment variable.

Definition at line 48 of file gaudi-policy.py.

48 
50  '''
51  insert_project_level_joboptpath adds ${INSTALL_AREA}/jobOptions into the
52  ${JOBOPTSEARCHPATH} environment variable.
53  '''
54  _get = getattr(self, 'hwaf_get_install_path', None)
55  if not _get: _get = getattr(self.bld, 'hwaf_get_install_path')
56  d = _get('${INSTALL_AREA}/jobOptions')
57  self.env.prepend_value('JOBOPTSEARCHPATH', d)
58  return
def gaudi-policy._gaudi_insert_project_level_pythonpath (   self)
private


insert_project_level_pythonpath adds ${INSTALL_AREA}/python into the
${PYTHONPATH} environment variable.

Definition at line 34 of file gaudi-policy.py.

34 
36  '''
37  insert_project_level_pythonpath adds ${INSTALL_AREA}/python into the
38  ${PYTHONPATH} environment variable.
39  '''
40  _get = getattr(self, 'hwaf_get_install_path', None)
41  if not _get: _get = getattr(self.bld, 'hwaf_get_install_path')
42  pydir = _get('${INSTALL_AREA}/python')
43  self.env.prepend_value('PYTHONPATH', pydir)
44  return
def gaudi-policy._gaudi_insert_project_level_xmlpath (   self)
private


insert_project_level_xmlpath adds ${INSTALL_AREA}/XML into the
${XMLPATH} environment variable.

Definition at line 76 of file gaudi-policy.py.

76 
78  '''
79  insert_project_level_xmlpath adds ${INSTALL_AREA}/XML into the
80  ${XMLPATH} environment variable.
81  '''
82  _get = getattr(self, 'hwaf_get_install_path', None)
83  if not _get: _get = getattr(self.bld, 'hwaf_get_install_path')
84  d = _get('${INSTALL_AREA}/XML')
85  self.env.prepend_value('XMLPATH', d)
86  return
def gaudi-policy.gaudi_application (   ctx,
  kw 
)


Definition at line 412 of file gaudi-policy.py.

413 def gaudi_application(ctx, **kw):
414  kw = dict(kw)
415 
416  name = kw['name']
417  source = kw["source"]
418  del kw['name']
419  del kw['source']
420 
421  ctx.gaudi_gen_package_version_header()
422 
423  # FIXME: hack !!! cppunit doesn't propagate correctly...
424  do_test = kw.get('do_test', False)
425  if do_test:
426  return
427 
428  kw['features'] = waflib.Utils.to_list(
429  kw.get('features', '')) + [
430  'cxx', 'cxxprogram', 'symlink_tsk',
431  ]
432 
433  kw['use'] = waflib.Utils.to_list(kw.get('use', []))
434 
435  pkg_node = ctx.path.get_src()
436  src_node = ctx.path.find_dir('src')
437 
438  srcs = ctx._cmt_get_srcs_lst(source)
439  linkflags = waflib.Utils.to_list(kw.get('linkflags', []))
440  linkflags = ctx.env.SHLINKFLAGS + linkflags
441  kw['linkflags'] = linkflags
442 
443  defines = waflib.Utils.to_list(kw.get('defines', []))
444  kw['defines'] = defines + ctx._get_pkg_version_defines()
445 
446  includes = waflib.Utils.to_list(kw.get('includes', []))
447  includes.insert(0, ctx.path.abspath())
448  #includes.insert(1, ctx.path.abspath()+'/'+PACKAGE_NAME)
449  kw['includes'] = includes + [src_node]
450 
451  # extract package name
452  PACKAGE_NAME = ctx._get_pkg_name()
453 
454  exe = ctx(
455  name=name,
456  source=srcs,
457  **kw)
458  exe.install_path = '${INSTALL_AREA}/bin'
459  exe.libpath = ctx.env.LD_LIBRARY_PATH + [ctx.path.get_bld().abspath()]
460  exe.target = name+'.exe'
461 
462  return exe
def gaudi-policy.gaudi_dictionary (   ctx,
  kw 
)


Definition at line 149 of file gaudi-policy.py.

150 def gaudi_dictionary(ctx, **kw):
151 
152  kw = dict(kw)
153 
154  name = kw["name"]
155  source = kw["source"]
156  selection_file = kw["selection_file"]
157 
158  del kw["name"]
159  del kw["source"]
160  del kw["selection_file"]
161 
162  o = ctx.build_reflex_dict(
163  name = name,
164  source = source,
165  selection_file = selection_file,
166  **kw
167  )
168  return o
def gaudi-policy.gaudi_gen_package_version_header (   ctx,
  kw 
)

Definition at line 602 of file gaudi-policy.py.

604  # extract package name
605  pkgname = osp.basename(ctx.hwaf_pkg_name())
606  hdr = ctx.path.get_bld().make_node('%sVersion.h' % pkgname)
607  def rule(task):
608  tgt = task.outputs[0]
609  data = '''
610 #ifndef %(proj)s_VERSION
611 /* Automatically generated file: do not modify! */
612 #ifndef CALC_GAUDI_VERSION
613 #define CALC_GAUDI_VERSION(maj,min) (((maj) << 16) + (min))
614 #endif
615 #define %(proj)s_MAJOR_VERSION %(maj)d
616 #define %(proj)s_MINOR_VERSION %(min)d
617 #define %(proj)s_PATCH_VERSION %(pat)d
618 #define %(proj)s_VERSION CALC_GAUDI_VERSION(%(proj)s_MAJOR_VERSION,%(proj)s_MINOR_VERSION)
619 #endif
620 ''' % getattr(task.generator, 'pkg_version_data')
621  tgt.write(data)
622  return
623 
624  pkg_infos = ctx.hwaf_pkg_infos()
625  version = pkg_infos.get('version', None)
626  if not version:
627  version_hwaf = ctx.path.get_src().find_resource('version.hwaf')
628  if version_hwaf: version = version_hwaf.read().strip()
629  else: version = 'HEAD'
630  pass
631 
632  # put at least some default value
633  majver, minver, patver = 999, 999, 0
634 
635  if version.startswith('HEAD'):
636  majver, minver, patver = 999, 999, 0 # special handling
637  else:
638  m = re.match("(v|([A-Za-z]+\-))(?P<maj_ver>[0-9]+)(r|\-)(?P<min_ver>[0-9]+)(?:(p|\-)(?P<pat_ver>[0-9]+))?", version)
639  if m:
640  majver = int(m.groupdict()['maj_ver'])
641  minver = int(m.groupdict()['min_ver'])
642  patver = int(m.groupdict()['pat_ver'] or 0)
643  pkg_version = (majver,minver,patver)
644 
645  if not ctx.env['GEN_PKG_VERSION_HDR_%s' % pkgname]:
646  ctx(
647  name = 'gen-pkg-version-hdr-'+pkgname,
648  rule = rule,
649  source = 'wscript',
650  target = hdr.name,
651  pkg_version_data = {
652  'proj':pkgname.upper(),
653  'maj': majver,
654  'min': minver,
655  'pat': patver,
656  },
657  before = 'cxx',
658  )
659  ctx.env['GEN_PKG_VERSION_HDR_%s' % pkgname] = '1'
660  return
def gaudi-policy.gaudi_install_data (   ctx,
  kw 
)


Definition at line 188 of file gaudi-policy.py.

189 def gaudi_install_data(ctx, **kw):
190  # extract package name
191  PACKAGE_NAME = osp.basename(ctx.hwaf_pkg_name())
192 
193  source = kw['source']
194  relative_trick = kw.get('relative_trick', False)
195  cwd = kw.get('cwd', None)
196  if cwd:
197  cwd = waflib.Utils.to_list(cwd)[0]
198  cwd = ctx.path.find_dir(cwd)
199 
200  source = waflib.Utils.to_list(source)
201  _srcs = []
202  for f in source:
203  _srcs.extend(ctx.path.ant_glob(f, dir=False))
204  source = _srcs[:]
205  del _srcs
206 
207  ctx.install_files(
208  '${INSTALL_AREA}/share',
209  source,
210  relative_trick=relative_trick,
211  cwd=cwd,
212  postpone=False,
213  )
214  return
def gaudi-policy.gaudi_install_headers (   ctx,
  incdir = None,
  relative_trick = True,
  cwd = None 
)


Definition at line 217 of file gaudi-policy.py.

218 def gaudi_install_headers(ctx, incdir=None, relative_trick=True, cwd=None):
219 
220  # extract package name
221  PACKAGE_NAME = osp.basename(ctx.hwaf_pkg_name())
222  inc_node = None
223  if not incdir:
224  inc_node = ctx.path.find_dir(PACKAGE_NAME)
225  if not inc_node:
226  return
227  else:
228  if isinstance(incdir, str):
229  inc_node = ctx.path.find_dir(incdir)
230  else:
231  inc_node = incdir
232  pass
233  pass
234 
235  if isinstance(cwd, str):
236  cwd = ctx.path.find_dir(cwd)
237 
238  if not inc_node:
239  ctx.fatal('no such directory [%s] (pkg=%s)' % (incdir, ctx.hwaf_pkg_name()))
240  pass
241 
242  includes = inc_node.ant_glob('**/*', dir=False)
243  ctx.install_files(
244  '${INSTALL_AREA}/include', includes,
245  relative_trick=relative_trick,
246  cwd=cwd,
247  postpone=False,
248  )
249 
250  incpath = waflib.Utils.subst_vars('${INSTALL_AREA}/include',ctx.env)
251  ctx.env.append_unique('INCLUDES_%s' % PACKAGE_NAME,
252  [incpath,inc_node.parent.abspath()])
253  # msg.info("--> [%s] %s: %r" %(PACKAGE_NAME,incpath,
254  # ctx.env.get_flat('INCLUDES_%s'%PACKAGE_NAME)))
255  return
def gaudi-policy.gaudi_install_joboptions (   ctx,
  kw 
)


Definition at line 171 of file gaudi-policy.py.

172 def gaudi_install_joboptions(ctx, **kw):
173  # extract package name
174  PACKAGE_NAME = osp.basename(ctx.hwaf_pkg_name())
175 
176  jobo_dir = ctx.path.find_dir('options')
177  jobos = jobo_dir.ant_glob('**/*', dir=False)
178 
179  ctx.install_files(
180  '${INSTALL_AREA}/jobOptions/%s' % PACKAGE_NAME,
181  jobos,
182  cwd=jobo_dir,
183  relative_trick=True
184  )
185  return
def gaudi-policy.gaudi_install_python_modules (   ctx,
  kw 
)


Definition at line 89 of file gaudi-policy.py.

89 
90 def gaudi_install_python_modules(ctx, **kw):
91  # extract package name
92  PACKAGE_NAME = osp.basename(ctx.hwaf_pkg_name())
93 
94  # add ${INSTALL_AREA}/python to PYTHONPATH if not there already
95  #pypath = ctx.hwaf_get_install_path('${INSTALL_AREA}/python')
96  pypath = waflib.Utils.subst_vars('${INSTALL_AREA}/python', ctx.env)
97  if not (pypath in ctx.env.get_flat('PYTHONPATH')):
98  ctx.env.prepend_value('PYTHONPATH', pypath)
99  pass
100 
101  #source = waflib.Utils.to_list(source)
102  pydir = ctx.path.find_dir('python')
103  if not pydir:
104  msg.error(
105  '[%s] no such directory: [%s]' % (
106  PACKAGE_NAME,
107  os.path.join(ctx.path.abspath(), 'python'),
108  )
109  )
110  msg.error('cannot execute [gaudi_install_python_modules]')
111  return
112  pyfiles = pydir.ant_glob(
113  '**/*',
114  dir=False,
115  relative_trick=True,
116  )
117  ctx(
118  features = 'py',
119  name = 'py-%s' % PACKAGE_NAME,
120  source = pyfiles,
121  install_path = '${INSTALL_AREA}/python/%s' % PACKAGE_NAME,
122  )
123  return
def gaudi-policy.gaudi_install_scripts (   ctx,
  kw 
)


Definition at line 126 of file gaudi-policy.py.

127 def gaudi_install_scripts(ctx, **kw):
128  # extract package name
129  PACKAGE_NAME = osp.basename(ctx.hwaf_pkg_name())
130 
131  source = kw.get('source', 'scripts/*')
132 
133  source = waflib.Utils.to_list(source)
134  _srcs = []
135  for f in source:
136  _srcs.extend(ctx.path.ant_glob(f, dir=False))
137  source = _srcs[:]
138  del _srcs
139 
140  ctx.install_files(
141  '${INSTALL_AREA}/bin',
142  source,
143  #relative_trick=True,
144  chmod=waflib.Utils.O755,
145  )
146  return
def gaudi-policy.gaudi_library (   ctx,
  kw 
)


Definition at line 263 of file gaudi-policy.py.

264 def gaudi_library(ctx, **kw):
265  # extract package name
266  PACKAGE_NAME = osp.basename(ctx.hwaf_pkg_name())
267 
268  ctx.gaudi_gen_package_version_header()
269 
270  kw = dict(kw)
271  name = kw['name']
272  source = kw["source"]
273  del kw['name']
274  del kw['source']
275 
276  linkflags = kw.get('linkflags', [])
277  linkflags = ctx.env.SHLINKFLAGS + linkflags
278  kw['linkflags'] = linkflags
279 
280  src_node = ctx.path.find_dir('src')
281 
282  srcs = ctx._cmt_get_srcs_lst(source)
283  includes = waflib.Utils.to_list(kw.get('includes', []))
284  includes.insert(0, ctx.path.abspath())
285  kw['includes'] = includes + [src_node]
286 
287  export_incs = None
288  kw['export_includes'] = waflib.Utils.to_list(
289  kw.get('export_includes', [])
290  )[:]
291  if not kw['export_includes']:
292  inc_node = ctx.path.find_dir(PACKAGE_NAME)
293  if inc_node:
294  export_incs = '.'
295  kw['export_includes'].append(export_incs)
296  else:
297  export_incs = kw['export_includes']
298  #msg.info('%s: exports: %r' % (name, kw['export_includes']))
299  pass
300 
301  kw['includes'].extend(kw['export_includes'])
302 
303  kw['use'] = waflib.Utils.to_list(kw.get('use', [])) + ['dl']
304 
305  defines = waflib.Utils.to_list(kw.get('defines', []))
306  kw['defines'] = defines + ctx._get_pkg_version_defines()
307 
308  kw['features'] = waflib.Utils.to_list(kw.get('features', [])) + [
309  'cxx', 'cxxshlib', 'symlink_tsk',
310  ]
311  kw['target'] = kw.get('target', name)
312 
313  #msg.info ("==> gaudi_library(%s, '%s', %r)..." % (name, srcs, kw.keys()))
314  o = ctx(
315  name = name,
316  source = srcs,
317  install_path = '${INSTALL_AREA}/lib',
318  libpath = ctx.env.LD_LIBRARY_PATH + [ctx.path.get_bld().abspath()],
319  **kw
320  )
321  o.reentrant = True
322  # for use-exports
323  ctx.env['LIB_%s' % name] = [name]
324  ctx.env.append_unique('LIBPATH_%s'%name, ctx.path.get_bld().abspath())
325 
326  uses = waflib.Utils.to_list(kw.get('use', []))
327  ctx.hwaf_propagate_uselib(name, uses)
328 
329  #msg.info('--> libpath[%s]: %s' % (name, ctx.env['LIBPATH_%s'%name]))
330  #msg.info('--> incpath[%s]: %s' % (name, export_incs))
331  if export_incs:
332  export_incs = waflib.Utils.to_list(export_incs)[0]
333  if export_incs == '.':
334  ctx.gaudi_install_headers()
335  pass
336  pass
337 
338  return o
def gaudi-policy.gaudi_module (   ctx,
  kw 
)


Definition at line 341 of file gaudi-policy.py.

342 def gaudi_module(ctx, **kw):
343  kw = dict(kw)
344  do_genmap = kw.get('do_genmap', True)
345  do_genconf= kw.get('do_genconf', True)
346 
347  name = kw['name']
348  source = kw["source"]
349  del kw['name']
350  del kw['source']
351 
352  ctx.gaudi_gen_package_version_header()
353 
354  #msg.info('=========== %s ============' % name)
355  #msg.info("::: %s" % ctx.path.abspath())
356  src_node = ctx.path.find_dir('src')
357  bld_node = src_node.get_bld()
358 
359  srcs = ctx._cmt_get_srcs_lst(source)
360  includes = waflib.Utils.to_list(kw.get('includes', []))
361  includes.insert(0, ctx.path.abspath())
362  includes.insert(1, ctx.path.get_bld().abspath())
363  #includes.insert(1, ctx.path.abspath()+'/'+PACKAGE_NAME)
364  kw['includes'] = includes + [src_node]
365 
366  linkflags = waflib.Utils.to_list(kw.get('linkflags', []))
367  linkflags = ctx.env.SHLINKFLAGS + linkflags
368  kw['linkflags'] = linkflags
369 
370  defines = waflib.Utils.to_list(kw.get('defines', []))
371  kw['defines'] = defines + ctx._get_pkg_version_defines()
372 
373  kw['depends_on'] = waflib.Utils.to_list(kw.get('use', [])) + \
374  waflib.Utils.to_list(kw.get('depends_on', []))
375  #print("---> depends: %s" % kw['depends_on'])
376 
377  # extract package name
378  PACKAGE_NAME = ctx._get_pkg_name()
379 
380  # schedule the requested features
381  features = ['cxx', 'cxxshlib',]
382  features.append('symlink_tsk')
383  if do_genmap:
384  features.append('gen_map')
385  if do_genconf:
386  features.append('gen_conf')
387  #features.append('py')
388 
389  kw['features'] = waflib.Utils.to_list(kw.get('features',[])) + features
390  kw['target'] = kw.get('target', name)
391 
392  lib = ctx(
393  name=name,
394  source=srcs,
395  **kw)
396  lib.name = 'complib-%s' % name
397  lib.reentrant = True
398  lib.install_path = '${INSTALL_AREA}/lib'
399  lib.libpath = ctx.env.LD_LIBRARY_PATH + [ctx.path.get_bld().abspath()]
400  lib_name = "lib%s.so" % (lib.target,) # FIXME !!
401  lib.env['GENCONF_LIBNAME'] = lib.target
402  lib.env['PACKAGE_NAME'] = PACKAGE_NAME
403 
404  return lib
def gaudi-policy.gaudi_pyext (   ctx,
  kw 
)


Definition at line 407 of file gaudi-policy.py.

408 def gaudi_pyext(ctx, **kw):
409  return
def gaudi-policy.gaudi_qmtest (   ctx,
  kw 
)


Definition at line 258 of file gaudi-policy.py.

259 def gaudi_qmtest(ctx, **kw):
260  return
def gaudi-policy.gen_conf_hook (   self,
  node 
)

Definition at line 475 of file gaudi-policy.py.

476 def gen_conf_hook(self, node):
477  "Bind the .dsomap file extension to the creation of a genconf task"
478  dso = self.env['GENCONF_LIBNAME']
479  bld_node = node.get_bld().parent
480  pkg_name = bld_node.name # FIXME!!
481  genconf_dir_node = bld_node.make_node('genConf').make_node(pkg_name)
482  self.env['GENCONF_OUTPUTDIR'] = genconf_dir_node.abspath()
483  genconf_node = genconf_dir_node.make_node('%sConf.py' % dso)
484  initpy_node = genconf_dir_node.make_node('__init__.py')
485  confdb_node = genconf_dir_node.make_node('%s_confDb.py' % dso)
486  tsk = self.create_task('gen_conf',
487  node,
488  [genconf_node,genconf_dir_node,initpy_node,confdb_node])
489  # schedule the merge of confdb.py files
490  merge_confdb_hook(self, confdb_node).set_run_after(tsk)
491 
492  # schedule the installation of py-files
493  src_node = self.path.get_src()
494  py_dir = src_node.find_dir('python')
495  py_files = [genconf_node, confdb_node]
496  if not py_dir:
497  py_files.append(initpy_node)
498  PACKAGE_NAME = self.env['PACKAGE_NAME']
499  self.bld(
500  features='py',
501  name ='py-genconf-%s' % PACKAGE_NAME,
502  source = py_files,
503  install_path = '${INSTALL_AREA}/python/%s' % PACKAGE_NAME,
504  )
505 
506  # add ${INSTALL_AREA}/python to PYTHONPATH if not there already
507  pypath = waflib.Utils.subst_vars('${INSTALL_AREA}/python', self.env)
508  if not pypath in self.env.get_flat('PYTHONPATH'):
509  self.env.prepend_value('PYTHONPATH', pypath)
510  pass
511 
512  return
def gaudi-policy.merge_confdb_hook (   self,
  node 
)

Definition at line 554 of file gaudi-policy.py.

555 def merge_confdb_hook(self, node):
556  global g_confdb_merger
557  if g_confdb_merger is None:
558  import os
559  bld_area = os.path.basename(self.env['BUILD_INSTALL_AREA'])
560  bld_node = self.bld.bldnode.find_dir(bld_area)
561  py_node = bld_node.make_node('python')
562  py_node.mkdir()
563  out_node = py_node.make_node(
564  'project_%s_merged_confDb.py' %
565  self.bld.hwaf_project_name().replace('-', '_')
566  )
567  g_confdb_merger = self.create_task('merge_confdb', node, out_node)
568  self.bld.install_files(
569  '${INSTALL_AREA}/python',
570  out_node,
571  relative_trick=False
572  )
573  else:
574  g_confdb_merger.inputs.append(node)
575  return g_confdb_merger
def gaudi-policy.schedule_gen_conf (   self)


Definition at line 466 of file gaudi-policy.py.

467 def schedule_gen_conf(self):
468  lnk_task = getattr(self, 'link_task', None)
469  if not lnk_task:
470  return
471  for n in lnk_task.outputs:
472  gen_conf_hook(self, n)
473  pass
474 
@after('symlink_tsk')
def gaudi-policy.schedule_merge_confdb (   self)

Definition at line 550 of file gaudi-policy.py.

551 def schedule_merge_confdb(self):
552  pass
553 
@extension('_confDb.py')

Variable Documentation

gaudi-policy.g_confdb_merger None

Definition at line 548 of file gaudi-policy.py.


Generated at Mon Feb 17 2014 14:38:16 for Gaudi Framework, version v25r0 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004