Anonymous avatar Anonymous committed 574ec3f

create AtlasCommonPolicy-00-00-14-branch

Comments (0)

Files changed (15)

+ba24ffc1218f21c67156189ae1c2315945b72b1f AtlasCommonPolicy-00-00-02
+c31fbb29ebb8e10d2944da9a6f1484c6b7c18c4c AtlasCommonPolicy-00-00-03
+50c5fc2cda19a3f7f05c201fcc5afe00a56cdb59 AtlasCommonPolicy-00-00-04
+b914531e42ab686d2cac17530b14bc05709f4779 AtlasCommonPolicy-00-00-05
+6b5e9dc85f9beaa3e1b203298f9a77a490847fee AtlasCommonPolicy-00-00-06
+dfba8e652f32451ffc70a221a9d9717870bc28c9 AtlasCommonPolicy-00-00-07
+681d112aca2a9f0679596f746f303451e50d05a1 AtlasCommonPolicy-00-00-08
+1c651c14868aa06c3cd8d2c304bb4dccc7bc1676 AtlasCommonPolicy-00-00-09
+ecc97d9f8c696e616ad5b254403ec7905410c812 AtlasCommonPolicy-00-00-10
+a40d40d3283e1e01706e31e1a67547df32030145 AtlasCommonPolicy-00-00-11
+75fa674110576a5daf8b592d26bc4a6e2792d7ff AtlasCommonPolicy-00-00-12
+54dae446d327c003e674ad550d26000d8cf521e9 AtlasCommonPolicy-00-00-13
+2011-09-08 Rolf Seuster <seuster AT cern.ch>
+    * adding new files from branch
+	* tagging AtlasCommonPolicy-00-00-14
+
+2011-09-07 Rolf Seuster <seuster AT cern.ch>
+    * cmt/requirements: Merging the branch AtlasCommonPolicy-00-00-11-branch (opt build with debug symbols in external files) into HEAD
+	* tagging AtlasCommonPolicy-00-00-13
+
+2011-08-29 David Quarrie <David.Quarrie@cern.ch>
+    * cmt/requirements: Mark the setup_runtime_cache fragment and pattern as being marked for deletion. 
+	* tagging AtlasCommonPolicy-00-00-12
+
+2011-03-31 David Quarrie <David.Quarrie@cern.ch>
+    * cmt/requirements: Add do_setup_runtime_cache pattern, document and fragment to support building the runtime cache for "cmt make"
+	* cmt/fragments/setup_runtime_cache:        } Document fragments
+	* cmt/fragments/setup_runtime_cache_header: } 
+	* tagging AtlasCommonPolicy-00-00-11
+
+2011-03-08 David Quarrie <David.Quarrie@cern.ch>
+	* scripts/setup_runtime_cache.sh: Add script to setup runtime cache for project
+	* tagging AtlasCommonPolicy-00-00-10
+
+2011-01-25 Emil Obreshkov <Emil.Obreshkov@cern.ch>
+	* cmt/post_install.sh: small fix 
+	* tagging AtlasCommonPolicy-00-00-09
+
+2010-09-13  Sebastien Binet  <sebastien.binet@cern.ch>
+
+	* tagging AtlasCommonPolicy-00-00-08
+	* install tpcnv.db files under installarea/cmtconfig/lib
+	* handle ara-specific t/p-cnv
+	* M scripts/abuild-gen-tpcnvdb.py
+
+2010-08-31  Sebastien Binet  <sebastien.binet@cern.ch>
+
+	* tagging AtlasCommonPolicy-00-00-07
+	* changed format of tpcnv db to ease pure C++ AthTPCnvSvc impl.
+	* M scripts/abuild-gen-tpcnvdb.py
+
+2010-08-20  Sebastien Binet  <sebastien.binet@cern.ch>
+
+	* tagging AtlasCommonPolicy-00-00-06
+	* add sensible defaults for gen-tpcnvdb
+	* M scripts/abuild-gen-tpcnvdb.py
+
+2010-07-30  Sebastien Binet  <sebastien.binet@cern.ch>
+
+	* tagging AtlasCommonPolicy-00-00-05
+	* fixups for project name + collect all rootmap files
+	* M scripts/abuild-merge-rootmap.py
+	* M scripts/abuild-merge-genconfdb.py
+
+2010-07-28  Sebastien Binet  <sebastien.binet@cern.ch>
+
+	* tagging AtlasCommonPolicy-00-00-04
+	* removed dependency on argparse
+	* M scripts/abuild-merge-genconfdb.py
+	* M scripts/abuild-merge-rootmap.py
+
+2010-07-09  Sebastien Binet  <sebastien.binet@cern.ch>
+
+	* tagging AtlasCommonPolicy-00-00-03
+	* adding post-install scripts for genconfdb, rootmap and tpcnvdb
+	* M cmt/requirements
+	* A scripts/abuild-merge-rootmap.py
+	* A scripts/abuild-merge-genconfdb.py
+	* A scripts/abuild-gen-tpcnvdb.py
+
+
+2009-07-22  David Quarrie <David.Quarrie@cern.ch>
+	* cmt/requirements: Add support for post_install action
+	* cmt/post_install.sh: Helper script to execute post_install actions on per-package basis
+	* Tagged as AtlasCommonPolicy-00-00-02
+	

cmt/fragments/application

+#-- start of application
+
+$(bin)${CONSTITUENT}${application_suffix} :: ${OBJS} $(use_stamps) $(${CONSTITUENT}_stamps) $(${CONSTITUENT}stamps) $(use_requirements)
+	$(link_echo) "application $@"
+	$(link_silent) ${LINKMACRO} -o $(@).new ${OBJS} $(cmt_installarea_linkopts) $(${CONSTITUENT}_use_linkopts) $(${CONSTITUENT}linkopts) && mv -f $(@).new $(@)
+ifneq (${SEPARATEDEBUG},)
+	$(echo) stripping dbg symbols into separate file $@$(debuginfosuffix)
+	$(link_silent) objcopy --only-keep-debug $@ $@$(debuginfosuffix)
+	$(link_silent) objcopy --strip-debug $@
+	$(link_silent) cd $(@D) && objcopy --add-gnu-debuglink=$(@F)$(debuginfosuffix) $(@F)
+endif
+
+#-----------------------------------------------------------------
+#
+#  New section for automatic installation
+#
+#-----------------------------------------------------------------
+
+install_dir = ${CMTINSTALLAREA}/$(tag)/bin
+${CONSTITUENT}installname = ${CONSTITUENT}${application_suffix}
+
+${CONSTITUENT} :: ${CONSTITUENT}install
+
+install :: ${CONSTITUENT}install
+
+${CONSTITUENT}install :: $(install_dir)/$(${CONSTITUENT}installname)
+ifdef CMTINSTALLAREA
+	$(echo) "installation done"
+endif
+
+$(install_dir)/$(${CONSTITUENT}installname) :: $(bin)$(${CONSTITUENT}installname)
+ifdef CMTINSTALLAREA
+	$(install_silent) $(cmt_install_action) \
+	    -source "`(cd $(bin); pwd)`" \
+	    -name "$(${CONSTITUENT}installname)" \
+	    -out "$(install_dir)" \
+	    -cmd "$(cmt_installarea_command)" \
+	    -cmtpath "$($(package)_cmtpath)"
+endif
+
+##${CONSTITUENT}clean :: ${CONSTITUENT}uninstall
+
+uninstall :: ${CONSTITUENT}uninstall
+
+${CONSTITUENT}uninstall ::
+ifdef CMTINSTALLAREA
+	$(cleanup_silent) $(cmt_uninstall_action) \
+	    -source "`(cd $(bin); pwd)`" \
+	    -name "$(${CONSTITUENT}installname)" \
+	    -out "$(install_dir)" \
+	    -cmtpath "$($(package)_cmtpath)"
+endif
+
+#	@echo "------> (${CONSTITUENT}.make) Removing installed files"
+#-- end of application

cmt/fragments/library

+#-- start of library_no_static ------
+
+#${CONSTITUENT}LIB :: $(${CONSTITUENT}lib) $(${CONSTITUENT}shstamp)
+${CONSTITUENT}LIB :: $(${CONSTITUENT}shstamp)
+	$(echo) "${CONSTITUENT} : library ok"
+
+$(${CONSTITUENT}lib) :: ${OBJS}
+	$(lib_echo) "static library $@"
+	$(lib_silent) cd $(bin); \
+	  $(ar) $(${CONSTITUENT}lib) $?
+	$(lib_silent) $(ranlib) $(${CONSTITUENT}lib)
+	$(lib_silent) cat /dev/null >$(${CONSTITUENT}stamp)
+
+#------------------------------------------------------------------
+#  Future improvement? to empty the object files after
+#  storing in the library
+#
+##	  for f in $?; do \
+##	    rm $${f}; touch $${f}; \
+##	  done
+#------------------------------------------------------------------
+
+#
+# We add one level of dependency upon the true shared library 
+# (rather than simply upon the stamp file)
+# this is for cases where the shared library has not been built
+# while the stamp was created (error??) 
+#
+
+$(${CONSTITUENT}libname).$(shlibsuffix) :: ${OBJS} $(use_requirements) $(${CONSTITUENT}stamps)
+	$(lib_echo) "shared library $@"
+	$(lib_silent) $(shlibbuilder) $(shlibflags) -o $@ ${OBJS} $(${CONSTITUENT}_shlibflags)
+
+$(${CONSTITUENT}shstamp) :: $(${CONSTITUENT}libname).$(shlibsuffix)
+	$(lib_silent) if test -f $(${CONSTITUENT}libname).$(shlibsuffix) ; then \
+	  cat /dev/null >$(${CONSTITUENT}stamp) && \
+	  cat /dev/null >$(${CONSTITUENT}shstamp) ; fi
+
+${CONSTITUENT}clean ::
+	$(cleanup_echo) objects ${CONSTITUENT}
+	$(cleanup_silent) /bin/rm -f ${OBJS}
+	$(cleanup_silent) /bin/rm -f $(patsubst %.o,%.d,${OBJS}) $(patsubst %.o,%.dep,${OBJS}) $(patsubst %.o,%.d.stamp,${OBJS})
+	$(cleanup_silent) cd $(bin); /bin/rm -rf ${CONSTITUENT}_deps ${CONSTITUENT}_dependencies.make
+
+#-----------------------------------------------------------------
+#
+#  New section for automatic installation
+#
+#-----------------------------------------------------------------
+
+install_dir = ${CMTINSTALLAREA}/$(tag)/lib
+${CONSTITUENT}installname = $(library_prefix)${CONSTITUENT}$(library_suffix).$(shlibsuffix)
+
+${CONSTITUENT} :: ${CONSTITUENT}install
+
+install :: ${CONSTITUENT}install
+
+${CONSTITUENT}install :: $(install_dir)/$(${CONSTITUENT}installname)
+ifdef CMTINSTALLAREA
+	$(echo) "installation done"
+endif
+
+$(install_dir)/$(${CONSTITUENT}installname) :: $(bin)$(${CONSTITUENT}installname)
+ifdef CMTINSTALLAREA
+	$(install_silent) $(cmt_install_action) \
+	    -source "`(cd $(bin); pwd)`" \
+	    -name "$(${CONSTITUENT}installname)" \
+	    -out "$(install_dir)" \
+	    -cmd "$(cmt_installarea_command)" \
+	    -cmtpath "$($(package)_cmtpath)"
+endif
+
+##${CONSTITUENT}clean :: ${CONSTITUENT}uninstall
+
+uninstall :: ${CONSTITUENT}uninstall
+
+${CONSTITUENT}uninstall ::
+ifdef CMTINSTALLAREA
+	$(cleanup_silent) $(cmt_uninstall_action) \
+	    -source "`(cd $(bin); pwd)`" \
+	    -name "$(${CONSTITUENT}installname)" \
+	    -out "$(install_dir)" \
+	    -cmtpath "$($(package)_cmtpath)"
+endif
+
+#-- end of library_no_static ------

cmt/fragments/library_no_share

+
+${CONSTITUENT}LIB :: $(${CONSTITUENT}lib)
+	@/bin/echo ${CONSTITUENT} : library ok
+
+$(${CONSTITUENT}lib) :: ${OBJS}
+	$(lib_echo) library
+	$(lib_silent) cd $(bin); \
+	  $(ar) $(${CONSTITUENT}lib) $?
+	$(lib_silent) $(ranlib) $(${CONSTITUENT}lib)
+	$(lib_silent) cat /dev/null >$(${CONSTITUENT}stamp)
+
+#------------------------------------------------------------------
+#  Future improvement? to empty the object files after
+#  storing in the library
+#
+##	  for f in $?; do \
+##	    rm $${f}; touch $${f}; \
+##	  done
+#------------------------------------------------------------------
+
+#-----------------------------------------------------------------
+#
+#  New section for automatic installation
+#
+#-----------------------------------------------------------------
+
+ifeq ($(INSTALLAREA),)
+installarea = $(CMTINSTALLAREA)
+else
+ifeq ($(findstring `,$(INSTALLAREA)),`)
+installarea = $(shell $(subst `,, $(INSTALLAREA)))
+else
+installarea = $(INSTALLAREA)
+endif
+endif
+
+install_dir = ${installarea}/${CMTCONFIG}/lib
+${CONSTITUENT}installname = $(library_prefix)${CONSTITUENT}$(library_suffix).a
+
+${CONSTITUENT} :: ${CONSTITUENT}install
+
+install :: ${CONSTITUENT}install
+
+${CONSTITUENT}install :: $(install_dir)/$($(CONSTITUENT)installname)
+	@if test ! "${installarea}" = ""; then\
+	  echo "installation done"; \
+	fi
+
+$(install_dir)/$($(CONSTITUENT)installname) :: $(bin)$(${CONSTITUENT}installname)
+	@if test ! "${installarea}" = ""; then \
+	  cd $(bin); \
+	  if test ! "$(install_dir)" = ""; then \
+	    if test ! -d "$(install_dir)"; then \
+	      mkdir -p $(install_dir); \
+	    fi ; \
+	    if test -d "$(install_dir)"; then \
+	      echo "Installing library $(${CONSTITUENT}installname) into $(install_dir)"; \
+	      if test -e $(install_dir)/$($(CONSTITUENT)installname); then \
+	        $(cmt_uninstall_area_command) $(install_dir)/$($(CONSTITUENT)installname); \
+	        $(cmt_uninstall_area_command) $(install_dir)/$($(CONSTITUENT)installname).cmtref; \
+	      fi; \
+	      $(cmt_install_area_command) `pwd`/$(${CONSTITUENT}installname) $(install_dir)/$($(CONSTITUENT)installname); \
+	      echo `pwd`/$(${CONSTITUENT}installname) >$(install_dir)/$($(CONSTITUENT)installname).cmtref; \
+	    fi \
+          else \
+	    echo "Cannot install library $(${CONSTITUENT}installname), no installation directory specified"; \
+	  fi; \
+	fi
+
+${CONSTITUENT}clean :: ${CONSTITUENT}uninstall
+
+uninstall :: ${CONSTITUENT}uninstall
+
+${CONSTITUENT}uninstall ::
+	@if test ! "${installarea}" = ""; then \
+	  cd $(bin); \
+	  if test ! "$(install_dir)" = ""; then \
+	    if test -d "$(install_dir)"; then \
+	      echo "Removing installed library $(${CONSTITUENT}installname) from $(install_dir)"; \
+	      $(cmt_uninstall_area_command) $(install_dir)/$($(CONSTITUENT)installname); \
+	      $(cmt_uninstall_area_command) $(install_dir)/$($(CONSTITUENT)installname).cmtref; \
+	    fi \
+          else \
+	    echo "Cannot uninstall library $(${CONSTITUENT}installname), no installation directory specified"; \
+	  fi; \
+	fi
+
+${CONSTITUENT}clean ::
+	$(cleanup_echo) ${OBJS}
+	$(cleanup_silent) cd $(bin); /bin/rm -f ${OBJS}
+

cmt/fragments/optdebug_library

+#-- start of optdebug_library ------
+#-- end of optdebug_library ------

cmt/fragments/optdebug_library_header

+#-- start of optdebug_library_header ------
+# create  a  two  part  executable.   One  a
+# stripped  binary  which will occupy less space in RAM and in a dis-
+# tribution and the second a debugging information file which is only
+# needed  if  debugging abilities are required
+# See GNU binutils OBJCOPY(1)
+# http://sourceware.org/binutils/docs-2.17/binutils/objcopy.html#objcopy
+
+depend=$(bin)$(library_prefix)$(library).$(shlibsuffix)
+target=$(depend)$(debuginfosuffix)
+
+${CONSTITUENT} :: $(target)
+
+$(target) : $(depend)
+	$(echo) stripping dbg symbols into separate file $@
+	$(link_silent) objcopy --only-keep-debug $< $@
+	$(link_silent) objcopy --strip-debug $<
+	$(link_silent) cd $(@D) && objcopy --add-gnu-debuglink=$(@F) $(<F)
+	$(link_silent) touch -c $@
+
+${CONSTITUENT}clean ::
+	/bin/rm -f ${target}
+
+#-- start of optdebug_library_header ------

cmt/fragments/setup_runtime_cache

+

cmt/fragments/setup_runtime_cache_header

+#
+#  We want to install all header files that follow the standard convention
+#
+#    ../<package>
+#
+#  into
+#
+#    ${CMTINSTALLAREA}/include/<package>/<package>
+#
+#  (with two levels of <package> directory)
+#
+
+install_cache_dir = ../${CMTCONFIG}/runtime
+
+${CONSTITUENT} :: ${CONSTITUENT}install
+
+install :: ${CONSTITUENT}install
+
+${CONSTITUENT}install :: $(install_cache_dir)
+
+$(install_cache_dir) ::
+	@if test "$(install_cache_dir)" = ""; then \
+	  echo "Cannot install header files, no installation directory specified"; \
+	else \
+	  $(ATLASCOMMONPOLICYROOT)/scripts/setup_runtime_cache.sh; \
+	fi
+
+clean :: ${CONSTITUENT}clean
+
+${CONSTITUENT}clean :: ${CONSTITUENT}uninstall
+
+uninstall :: ${CONSTITUENT}uninstall
+
+${CONSTITUENT}uninstall ::
+	@if test "$(install_cache_dir)" = ""; then \
+	  echo "Cannot uninstall header files, no installation directory specified"; \
+	else \
+	  if test -d $(install_cache_dir) ; then \
+	    echo "Uninstalling files from $(install_cache_dir)"; \
+	    eval rm -rf $(install_cache_dir) ; \
+	  fi \
+	fi
+
+

cmt/post_install.sh

+#!/bin/sh
+#+
+#	Script to execute post-installation commands
+#
+#	Author:-
+#	David Quarrie
+#-
+
+if [ ! -z "$1" ]; then
+	if [ -f $1 ]; then
+		sh $1
+	fi
+fi
+package AtlasCommonPolicy
+
+author David Quarrie
+
+use LCG_Platforms *
+
+# This package is designed to be the base for policies and patterns that are
+# common between the ATLAS offline and online environments
+
+# Define action that implements a post-install action
+action post_install "$(ATLASCOMMONPOLICYROOT)/cmt/post_install.sh $(post_install_script)"
+
+action post_merge_rootmap \
+ "$(ATLASCOMMONPOLICYROOT)/scripts/abuild-merge-rootmap.py"
+
+action post_merge_genconfdb \
+ "$(ATLASCOMMONPOLICYROOT)/scripts/abuild-merge-genconfdb.py"
+
+action post_build_tpcnvdb \
+ "$(ATLASCOMMONPOLICYROOT)/scripts/abuild-gen-tpcnvdb.py $(CMTINSTALLAREA)"
+
+action all_post_constituents echo "running postaction"
+ 
+# DRQ: This pattern and fragment create the runtime setup cache during "make". 
+# They are retained for backwards compatibility but should be deleted at some point 
+make_fragment setup_runtime_cache -header=setup_runtime_cache_header
+pattern do_setup_runtime_cache \
+    document setup_runtime_cache do_setup_runtime_cache
+
+# library_no_static fragment from core CMT (renamed as library)
+# to allow for shared library only to be built by default
+# (instead of shared + static libraries)
+# to disable this fragment/behaviour, activate tag WithStatic
+tag static WithStatic
+tag UnixStatic WithStatic
+macro library_fragment "library" WithStatic ""
+make_fragment $(library_fragment)
+make_fragment application
+
+apply_tag separate-debug
+macro SEPARATEDEBUG "" separate-debug&target-opt&target-linux "1"
+macro_append cppflags  ""  separate-debug&target-opt&target-linux  " -g "
+macro_append cflags    ""  separate-debug&target-opt&target-linux  " -g "
+macro_append fflags    ""  separate-debug&target-opt&target-linux  " -g "
+macro debuginfosuffix  ".debug"
+
+make_fragment optdebug_library -header=optdebug_library_header
+
+pattern optdebug_library \
+   private ; \
+   macro apply_optdebug_library "without_optdebug_library" separate-debug&target-opt&target-linux "with_optdebug_library" ; \
+   apply_pattern $(apply_optdebug_library) name=<name>  ; \
+   end_private
+
+pattern with_optdebug_library \
+   private ; \
+   document optdebug_library <name>_optdebug_library library=<name>  ; \
+   macro_append <name>_optdebug_library_dependencies " <name>" ; \
+   end_private
+
+pattern without_optdebug_library \
+   private ; \
+   macro dummy_for_library "<name>" ; \
+   end_private

scripts/abuild-gen-tpcnvdb.py

+#!/usr/bin/env python
+
+__doc__ = """a simple python script to extract informations relative to T/P converter libraries"""
+
+import os
+
+try:
+    from PyUtils.Decorators import forking
+except ImportError:
+    def forking(fct):
+        return fct
+
+_exclude_list = [
+    'libpyquen.so',
+    'libhydjet.so',
+    'libjetset73hydjet.so',
+    'libpythia6.so',
+    'libpythia6_dummy.so',
+    'libpythia6_pdfdummy.so',
+    'MEee2gZ2qq.so',
+    ## libAhadicFormation.so,
+    ## libExoGraviton_i.so,
+    ## libToolsMath.so,
+    ## GRVBase.so,
+    ## libSherpaMain.so,
+    ## libPythia8_i.so,
+    ## libCascade_iLib.so,
+    
+    ]
+"""list of libraries to exclude from massaging
+"""
+
+def import_root(batch=True):
+    import PyCintex
+    PyCintex.Cintex.Enable()
+    import sys
+    sys.argv.insert(1, '-b')
+    import ROOT
+    ROOT.gROOT.SetBatch(batch)
+    ROOT.gErrorIgnoreLevel = ROOT.kError
+    del sys.argv[1]
+    return ROOT
+
+def import_pyathena(batch=True):
+    import AthenaPython.PyAthena as PyAthena
+    import_root(batch)
+    return PyAthena
+
+def _get_mbr_factories():
+    pyathena = import_pyathena()
+    rflx_scope = getattr(pyathena, 'Reflex::Scope')
+    factories = rflx_scope.ByName('__pf__')
+    members = [factories.FunctionMemberAt(i)
+               for i in xrange(factories.FunctionMemberSize())]
+    return members
+
+def _get_props(mbr):
+    _props = mbr.Properties()
+    props = {}
+    for i in xrange(_props.KeySize()):
+        k = _props.KeyAt(i)
+        v = _props.PropertyAsString(i)
+        props[k] = v
+    return props
+
+def _get_id(fct):
+    props = _get_props(fct)
+    if 'id' in props and props['id']:
+        return props['id']
+    return props['name']
+
+@forking
+def inspect_library(libname):
+    tpcnv_db = {}
+    print "::: inspecting [%s]..." % (libname,)
+    pyathena = import_pyathena()
+    pyathena.load_library('AthenaKernelDict')
+    is_in_dso = pyathena.Athena.DsoUtils.inDso
+
+    members = _get_mbr_factories()
+    
+    #print "-->",len(members)
+    bkg = set()
+    for i,fct in enumerate(members):
+        ident = _get_id(fct)
+        #print "==",ident
+        bkg.add(ident)
+    #bkg = list(bkg)
+
+    # load the component library
+    print "::: loading [%s]..." % (libname,)
+    dso = pyathena.load_library(libname)
+
+    lib_dsoname = os.path.basename(pyathena.find_library(libname))
+    
+    members = _get_mbr_factories()
+    #print "-->",len(members)
+   
+    for mbr in members:
+        props = _get_props(mbr)
+        ident = _get_id(mbr)
+        #print " ~~~>",ident
+        if ident in bkg:
+            print "\t==> skipping [%s]..." % (ident,)
+            continue
+        if not is_in_dso(mbr, lib_dsoname):
+            print "\t==> skipping [%s]... (not a local symbol)" % (ident,)
+            continue
+            
+        ret_type = mbr.TypeOf().ReturnType()
+        ret_type = ret_type.Name()
+        component_type = {
+            'IInterface*' : 'IInterface',
+            'IAlgorithm*' : 'Algorithm',
+            'IService*':    'Service',
+            'IAlgTool*':    'AlgTool',
+            'IAuditor*':    'Auditor',
+            'IConverter*':  'Converter',
+            'DataObject*':  'DataObject',
+            'ITPCnvBase*':  'TPCnv',
+            }.get(ret_type, 'Unknown')
+        if ident == 'ApplicationMgr':
+            component_type = 'ApplicationMgr'
+        if component_type != 'TPCnv':
+            continue
+        name = ident.strip()
+        props['latest_vers'] = '1' if props['latest_vers'] == '1' else '0'
+        props['is_ara_cnv'] = props.get('is_ara_cnv', '0')
+        props['is_ara_cnv'] = '0' if props['is_ara_cnv'] in ('','0') else '1'
+        print " - tpcnv:",name,props
+        tpcnv_db[name] = {'tpcnv': name,
+                          'pers_type': props['pers_type'],
+                          'trans_type': props['trans_type'],
+                          'latest_vers': props['latest_vers'],
+                          'is_ara_cnv': props['is_ara_cnv'],
+                          'libname': lib_dsoname}
+        
+    return tpcnv_db
+
+def inspect_installarea(topdir=None):
+    if topdir is None:
+        cmtpath = os.environ['CMTPATH']
+        topdir = os.path.join(cmtpath.split(os.pathsep)[0],
+                              'InstallArea')
+    if os.path.exists(os.path.join(topdir, 'InstallArea')):
+        topdir = os.path.join(topdir, 'InstallArea')
+    topdir = os.path.expandvars(topdir)
+    topdir = os.path.expanduser(topdir)
+    topdir = os.path.join(topdir,os.environ['CMTCONFIG'],'lib')
+
+    if not os.path.exists(topdir):
+        print "**error** no such directory [%s]" % (topdir,)
+        return {}
+    
+    # load some needed libraries and tools
+    pyathena = import_pyathena()
+    pyathena.load_library('AthenaKernelDict')
+    is_in_dso = pyathena.Athena.DsoUtils.inDso
+
+    tpcnv_db = {}
+    from glob import glob
+    dso_files = glob(os.path.join(topdir,'*TPCnv.so'))
+    for dso in dso_files:
+        libname = os.path.basename(dso)
+        if libname in _exclude_list:
+            print "::: skipping:",dso
+            continue
+        try:
+            db = inspect_library(libname)
+            tpcnv_db.update(db)
+        except Exception,err:
+            pass
+
+    return tpcnv_db
+
+def save_tpcnv_db(tpcnv_db, fname):
+    """save the registry of T/P converter into file `fname`
+    
+    Arguments:
+    - `tpcnv_db`: a dict of 'tpcnv name' -> {'trans','pers','version'}
+    - `fname`: the file name where to save the db
+    """
+
+    fname = os.path.expandvars(fname)
+    fname = os.path.expanduser(fname)
+
+    if os.path.exists(fname):
+        os.remove(fname)
+
+    with open(fname, 'w+') as fd:
+        print >> fd, "# automatically produced"
+        print >> fd, "# a db of T/P converters"
+        fmt = "%(libname)s;%(tpcnv)s;" + \
+              "%(trans_type)s;%(pers_type)s;%(latest_vers)s;%(is_ara_cnv)s"
+        for k,v in tpcnv_db.iteritems():
+            print >> fd, fmt % v
+        fd.flush()
+
+    return
+
+def main():
+    import argparse
+    parser = argparse.ArgumentParser(
+        prog='abuild-gen-tpcnvdb',
+        description="""\
+        inspect a (set of) InstallArea(s) and extract the informations related
+        to T/P converters"""
+        )
+
+    def _install_area():
+        cmtpath = os.environ['CMTPATH'].split(os.pathsep)[0]
+        install_area = os.path.join(cmtpath, 'InstallArea')
+        return install_area
+    
+    parser.add_argument(
+        'install-area',
+        default=_install_area(),
+        #dest='install_area',
+        nargs='*',
+        help='the path to the install area to inspect'
+        )
+
+    def _outfname():
+        cmtpath = os.environ['CMTPATH'].split(os.pathsep)[0]
+        cmtconf = os.environ['CMTCONFIG']
+        install_area = os.path.join(cmtpath, 'InstallArea')
+        outdir = os.path.join(install_area, cmtconf, 'lib')
+        outfname = os.path.join(outdir, 'tpcnv.db')
+        return outfname
+    
+    parser.add_argument(
+        '-o','--output-file',
+        default=_outfname(),
+        help='the path to the file where T/P cnv infos will be saved [default=%(default)s]')
+
+    parser.add_argument(
+        '-v','--verbose',
+        action='store_true',
+        default=False,
+        help='enable verbose output')
+
+    args = parser.parse_args()
+
+    outdir = os.path.dirname(args.output_file)
+    if not os.path.exists(outdir):
+        os.makedirs(outdir)
+
+    install_area = []
+    _install_area = getattr(args, 'install-area')
+    if isinstance(_install_area, basestring):
+        _install_area = _install_area.split(os.pathsep)
+    else:
+        _install_area = list(_install_area)
+
+    for i,d in enumerate(_install_area[:]):
+        _install_area[i] = os.path.expanduser(os.path.expandvars(d))
+
+    for d in _install_area:
+        install_area.extend(d.split(os.pathsep))
+
+    print ":"*80
+    print ":::",parser.prog
+
+    #############################
+    # silence root error-printout
+    # it tries to feed a foo/path:bar/path:baz/path to a TUrl
+    # (and complains it isn't a valid URL. d'oh!)
+    sys.argv = sys.argv[:1]
+    #############################
+    
+    db = {}
+    for topdir in install_area:
+        print "::  install-area [%s]..." % (topdir,)
+        db.update(inspect_installarea(topdir=topdir))
+    save_tpcnv_db(db, args.output_file)
+
+    print "::: bye."
+    print ":"*80
+    return 0
+
+if __name__ == "__main__":
+    try:
+        import argparse
+    except ImportError:
+        print ""
+        print "*** could not import 'argparse'. not enough project-karma ?"
+        main = lambda : 0
+    
+    import sys
+    sys.exit(main())
+    
+    
+

scripts/abuild-merge-genconfdb.py

+#!/usr/bin/env python
+
+__doc__ = """asimple script to merge all _confDb files into a project-wide _merged_confDb file"""
+
+### imports --------------------------------------------------------------------
+import os
+import sys
+from fnmatch import fnmatch
+import shutil
+import getopt
+
+_useropts = "o:vh"
+_userlongopts = [
+    "install-area=",
+    "output-file=",
+    "verbose",
+    "help"
+    ]
+_error_msg = """\
+inspect a (set of) InstallArea(s), collect all confDb files and merge them into one single project-wide merged_confDb file.
+
+Accepted command line options:
+     --install-area=<path or env.var> ...  path to the InstallArea to inspect
+ -o, --output-file                    ...  name of the merged output file
+ -v, --verbose                        ...  enable verbose mode
+ -h, --help                           ...  print this help message
+"""
+
+### functions ------------------------------------------------------------------
+
+def collect_genconfdb_fnames(topdir,
+                             pattern='*confDb.py',
+                             exclude_pattern='*_merged_confDb.py'):
+                          
+    """ recursively inspect the `topdir` directory for files named '*confDb.py'
+        but exclude the files named '*_merged_confDb.py'
+        returns a list of unique real paths
+    """
+    print "::: collecting genconfdb files..."
+    all_files = []
+    # we need the 'followlinks' argument
+    if sys.version_info[:2] < (2,6): os_walk = _walk
+    else:                            os_walk = os.walk
+
+    for root, dirs, files in os_walk(topdir, followlinks=True):
+        for f in files:
+            if fnmatch(f, pattern) and not fnmatch(f, exclude_pattern):
+                full_name = os.path.join(root, f)
+                full_name = os.path.realpath(full_name)
+                all_files.append(full_name)
+                print " - [%s]" % (full_name,)
+                
+    all_files = list(set(all_files))
+    print "::: collecting genconfdb files... [done] (nbr=%i)" % (len(all_files),)
+    return all_files
+    
+def merge_files(fnames, ofname):
+    """merge the content of all files `fnames` into the file `ofname`
+    """
+    print "::: merging files into [%s]..." % (ofname,)
+    _copy = shutil.copyfileobj
+    ofile = open(ofname, 'w')
+    for fname in fnames:
+        print "::: processing [%s]..." % (fname,)
+        _copy(fsrc=open(fname, 'r'), fdst=ofile)
+        ofile.flush()
+    ofile.close()
+    
+    print "::: merging files into [%s]... [done]" % (ofname,)
+    return 0
+
+def do_merge_files(topdir, ofname,
+                   pattern='*_confDb.py',
+                   exclude_pattern='*_merged_confDb.py'):
+
+    if isinstance(topdir, basestring):
+        topdir = topdir.split(os.pathsep)
+        
+    confdb_fnames = []
+    for d in topdir:
+        confdb_fnames.extend(collect_genconfdb_fnames(d, pattern,
+                                                      exclude_pattern))
+
+    return merge_files(confdb_fnames, ofname)
+
+def main():
+    """the main entry point of this script
+    """
+
+    class Options(object):
+        """place holder for command line options values"""
+        pass
+    
+    def _help_and_exit():
+        print _error_msg
+        sys.exit(1)
+        
+    def _install_area():
+        cmtpath = os.environ['CMTPATH'].split(os.pathsep)[0]
+        install_area = os.path.join(cmtpath, 'InstallArea')
+        return install_area
+    
+    def _outfname():
+        cmtpath = os.environ['CMTPATH'].split(os.pathsep)[0]
+        proj_name = os.path.basename(cmtpath)
+        try:
+            proj_name = cmtpath.split(os.sep)[-2]
+        except Exception:
+            pass
+        cmtconf = os.environ['CMTCONFIG']
+        install_area = os.path.join(cmtpath, 'InstallArea')
+        pyvers = 'python%s.%s' % sys.version_info[:2]
+        outdir = os.path.join(install_area, cmtconf, 'lib', pyvers)
+        outfname = os.path.join(outdir, '%s_merged_confDb.py' % proj_name)
+        return outfname
+
+    opts = Options()
+    opts.install_area = _install_area()
+    opts.output_file = _outfname()
+    opts.verbose = False
+
+    # process user options
+    try:
+        optlist, args = getopt.getopt(sys.argv[1:], _useropts, _userlongopts)
+    except getopt.error:
+        print sys.exc_value
+        _help_and_exit()
+        pass
+
+    if args:
+        print "Unhandled arguments:", args
+        _help_and_exit()
+        pass
+
+    for opt, arg in optlist:
+        if opt in ("--install-area",):
+            opts.install_area = arg
+            pass
+        elif opt in ("-o", "--output-file",):
+            opts.output_file = arg
+            pass
+        elif opt in ("-v", "--verbose"):
+            opts.verbose = True
+            pass
+        elif opt in ("-h", "--help"):
+            _help_and_exit()
+            pass
+        else:
+            print "Unknown option:", opt
+            _help_and_exit()
+            pass
+        
+    #print args
+
+    install_area = []
+    _install_area = opts.install_area[:]
+    if isinstance(_install_area, basestring):
+        _install_area =[_install_area]
+    else:
+        _install_area = list(_install_area)
+
+    for i,d in enumerate(_install_area[:]):
+        _install_area[i] = os.path.expanduser(os.path.expandvars(d))
+
+    for d in _install_area:
+        install_area.extend(d.split(os.pathsep))
+        
+    outdir = os.path.dirname(opts.output_file)
+    if not os.path.exists(outdir):
+        if outdir:
+            os.makedirs(outdir)
+    
+    if os.path.exists(opts.output_file):
+        os.remove(opts.output_file)
+        
+    print ":"*80
+    print "::: abuild-merge-genconfdb"
+    rc = do_merge_files(topdir=install_area,
+                        ofname=opts.output_file)
+    print "::: bye."
+    print ":"*80
+    return rc
+
+# copied verbatim from py-2.6
+def _walk(top, topdown=True, onerror=None, followlinks=False):
+    """Directory tree generator.
+ 
+    For each directory in the directory tree rooted at top (including top
+    itself, but excluding '.' and '..'), yields a 3-tuple
+ 
+        dirpath, dirnames, filenames
+ 
+    dirpath is a string, the path to the directory.  dirnames is a list of
+    the names of the subdirectories in dirpath (excluding '.' and '..').
+    filenames is a list of the names of the non-directory files in dirpath.
+    Note that the names in the lists are just names, with no path components.
+    To get a full path (which begins with top) to a file or directory in
+    dirpath, do os.path.join(dirpath, name).
+ 
+    If optional arg 'topdown' is true or not specified, the triple for a
+    directory is generated before the triples for any of its subdirectories
+    (directories are generated top down).  If topdown is false, the triple
+    for a directory is generated after the triples for all of its
+    subdirectories (directories are generated bottom up).
+ 
+    When topdown is true, the caller can modify the dirnames list in-place
+    (e.g., via del or slice assignment), and walk will only recurse into the
+    subdirectories whose names remain in dirnames; this can be used to prune
+    the search, or to impose a specific order of visiting.  Modifying
+    dirnames when topdown is false is ineffective, since the directories in
+    dirnames have already been generated by the time dirnames itself is
+    generated.
+ 
+    By default errors from the os.listdir() call are ignored.  If
+    optional arg 'onerror' is specified, it should be a function; it
+    will be called with one argument, an os.error instance.  It can
+    report the error to continue with the walk, or raise the exception
+    to abort the walk.  Note that the filename is available as the
+    filename attribute of the exception object.
+ 
+    By default, os.walk does not follow symbolic links to subdirectories on
+    systems that support them.  In order to get this functionality, set the
+    optional argument 'followlinks' to true.
+ 
+    Caution:  if you pass a relative pathname for top, don't change the
+    current working directory between resumptions of walk.  walk never
+    changes the current directory, and assumes that the client doesn't
+    either.
+ 
+    Example:
+ 
+    import os
+    from os.path import join, getsize
+    for root, dirs, files in os.walk('python/Lib/email'):
+        print root, "consumes",
+        print sum([getsize(join(root, name)) for name in files]),
+        print "bytes in", len(files), "non-directory files"
+        if 'CVS' in dirs:
+            dirs.remove('CVS')  # don't visit CVS directories
+    """
+ 
+    from os.path import join, isdir, islink
+ 
+    # We may not have read permission for top, in which case we can't
+    # get a list of the files the directory contains.  os.path.walk
+    # always suppressed the exception then, rather than blow up for a
+    # minor reason when (say) a thousand readable directories are still
+    # left to visit.  That logic is copied here.
+    try:
+        # Note that listdir and error are globals in this module due
+        # to earlier import-*.
+        names = os.listdir(top)
+    except os.error, err:
+        if onerror is not None:
+            onerror(err)
+        return
+ 
+    dirs, nondirs = [], []
+    for name in names:
+        if isdir(join(top, name)):
+            dirs.append(name)
+        else:
+            nondirs.append(name)
+ 
+    if topdown:
+        yield top, dirs, nondirs
+    for name in dirs:
+        path = join(top, name)
+        if followlinks or not islink(path):
+            for x in _walk(path, topdown, onerror, followlinks):
+                yield x
+    if not topdown:
+        yield top, dirs, nondirs
+
+if __name__ == "__main__":
+    import sys
+    sys.exit(main())

scripts/abuild-merge-rootmap.py

+#!/usr/bin/env python
+
+__doc__ = """asimple script to merge all .dsomap files into a project-wide .rootmap file"""
+
+### imports --------------------------------------------------------------------
+import os
+import sys
+from fnmatch import fnmatch as _fnmatch
+import shutil
+import getopt
+
+### globals --------------------------------------------------------------------
+_dsomap_exclude_list = [
+    "TestRootConversions1Dict.dsomap",
+    "TestRootConversions2Dict.dsomap",
+    "DataModelTestDataRead.rootmap",
+    "DataModelTestDataWriteCnvPoolCnv.rootmap",
+    "DataModelTestDataReadCnvPoolCnv.rootmap",
+    "DataModelTestDataReadDict.dsomap",
+    "DataModelTestDataWriteDict.dsomap",
+    ]
+"""list of dsomap files to ignore from the merge"""
+
+_useropts = "i:o:vh"
+_userlongopts = [
+    "install-area=",
+    "output-file=",
+    "verbose",
+    "help"
+    ]
+_error_msg = """\
+inspect a (set of) InstallArea(s), collect all .dsomap files and merge them into one single project-wide .rootmap file.
+
+Accepted command line options:
+ -i, --install-area=<path or env.var> ...  path to the InstallArea to inspect
+ -o, --output-file                    ...  name of the merged output file
+ -v, --verbose                        ...  enable verbose mode
+ -h, --help                           ...  print this help message
+"""
+
+### functions ------------------------------------------------------------------
+
+def fnmatch(path, pattern):
+    """helper function to test multiple patterns
+    """
+    patterns = pattern
+    if isinstance(patterns, basestring):
+        patterns = [patterns]
+    for pattern in patterns:
+        if _fnmatch(path, pattern):
+            return True
+    return False
+
+def _is_in_ignore_list(fname):
+    """ helper method to test if `fname` is in any of the ignore list
+    """
+    bfname = os.path.basename(fname)
+    return bfname in _dsomap_exclude_list
+
+def collect_dsomap_fnames(topdir, pattern=['*.dsomap','*.rootmap']):
+    """ recursively inspect the `topdir` directory for files named '*.dsomap'
+        returns a list of unique real paths
+    """
+    print "::: collecting dsomap files..."
+    all_files = []
+    # we need the 'followlinks' argument
+    if sys.version_info[:2] < (2,6): os_walk = _walk
+    else:                            os_walk = os.walk
+
+    if isinstance(pattern, basestring):
+        pattern = [pattern]
+
+    # opt hack
+    _install_area_cmtcfg = os.path.join('InstallArea', os.environ['CMTCONFIG'])
+    
+    for root, dirs, files in os_walk(topdir, followlinks=True):
+        for f in files:
+            if fnmatch(f, pattern):
+                full_name = os.path.join(root, f)
+                full_name = os.path.realpath(full_name)
+                if (os.environ['CMTCONFIG'] in full_name and
+                    not _is_in_ignore_list(full_name) and
+                    # FIXME: we can't rely on *ALL* files being under the
+                    # install-area b/c of component libs!
+                    #not _install_area_cmtcfg in full_name and
+                    1):
+                    all_files.append(full_name)
+                    print " - [%s]" % (full_name,)
+                
+    all_files = list(set(all_files))
+    print "::: collecting dsomap files... [done] (nbr=%i)" % (len(all_files),)
+    return all_files
+    
+def merge_files(fnames, ofname):
+    """merge the content of all files `fnames` into the file `ofname`
+    """
+    print "::: merging files into [%s]..." % (ofname,)
+    _copy = shutil.copyfileobj
+    ofile = open(ofname, 'w')
+    for fname in fnames:
+        print "::: processing [%s]..." % (fname,)
+        _copy(fsrc=open(fname, 'r'), fdst=ofile)
+        ofile.flush()
+    ofile.close()
+    
+    print "::: merging files into [%s]... [done]" % (ofname,)
+    return 0
+
+def do_merge_files(topdir, ofname, pattern=['*.dsomap','*.rootmap']):
+
+    if isinstance(topdir, basestring):
+        topdir = topdir.split(os.pathsep)
+        
+    dsomap_fnames = []
+    for d in topdir:
+        dsomap_fnames.extend(collect_dsomap_fnames(d, pattern))
+    return merge_files(dsomap_fnames, ofname)
+
+def main():
+    """the main entry point of this script
+    """
+
+    class Options(object):
+        """place holder for command line options values"""
+        pass
+    
+    def _help_and_exit():
+        print _error_msg
+        sys.exit(1)
+        
+    def _install_area():
+        cmtpath = os.environ['CMTPATH'].split(os.pathsep)[0]
+        install_area = os.path.join(cmtpath, 'InstallArea')
+        #return install_area
+        # FIXME: we should only return the install-area, but some needed
+        # rootmap files (for component libs) are installed under the pkg
+        # $CMTCONFIG directory and not installed under the install-area
+        return cmtpath
+    
+    def _outfname():
+        cmtpath = os.environ['CMTPATH'].split(os.pathsep)[0]
+        proj_name = os.path.basename(cmtpath)
+        try:
+            proj_name = cmtpath.split(os.sep)[-2]
+        except Exception:
+            pass
+        cmtconf = os.environ['CMTCONFIG']
+        install_area = os.path.join(cmtpath, 'InstallArea')
+        outdir = os.path.join(install_area, cmtconf, 'lib')
+        outfname = os.path.join(outdir, '%s.rootmap' % proj_name)
+        return outfname
+
+    opts = Options()
+    opts.install_area = _install_area()
+    opts.output_file = _outfname()
+    opts.verbose = False
+
+    # process user options
+    try:
+        optlist, args = getopt.getopt(sys.argv[1:], _useropts, _userlongopts)
+    except getopt.error:
+        print "-->",_useropts
+        print sys.exc_value
+        _help_and_exit()
+        pass
+
+    if args:
+        print "Unhandled arguments:", args
+        _help_and_exit()
+        pass
+
+    for opt, arg in optlist:
+        if opt in ("-i", "--install-area",):
+            opts.install_area = arg
+            pass
+        elif opt in ("-o", "--output-file",):
+            opts.output_file = arg
+            pass
+        elif opt in ("-v", "--verbose"):
+            opts.verbose = True
+            pass
+        elif opt in ("-h", "--help"):
+            _help_and_exit()
+            pass
+        else:
+            print "Unknown option:", opt
+            _help_and_exit()
+            pass
+        
+    #print args
+
+    install_area = []
+    _install_area = opts.install_area[:]
+    if isinstance(_install_area, basestring):
+        _install_area =[_install_area]
+    else:
+        _install_area = list(_install_area)
+
+    for i,d in enumerate(_install_area[:]):
+        _install_area[i] = os.path.expanduser(os.path.expandvars(d))
+
+    for d in _install_area:
+        install_area.extend(d.split(os.pathsep))
+        
+    
+    
+    outdir = os.path.dirname(opts.output_file)
+    if not os.path.exists(outdir):
+        if outdir:
+            os.makedirs(outdir)
+
+    if os.path.exists(opts.output_file):
+        os.remove(opts.output_file)
+        
+    print ":"*80
+    print "::: abuild-merge-rootmap"
+    rc = do_merge_files(topdir=install_area,
+                        ofname=opts.output_file)
+    print "::: bye."
+    print ":"*80
+    return rc
+
+# copied verbatim from py-2.6
+def _walk(top, topdown=True, onerror=None, followlinks=False):
+    """Directory tree generator.
+ 
+    For each directory in the directory tree rooted at top (including top
+    itself, but excluding '.' and '..'), yields a 3-tuple
+ 
+        dirpath, dirnames, filenames
+ 
+    dirpath is a string, the path to the directory.  dirnames is a list of
+    the names of the subdirectories in dirpath (excluding '.' and '..').
+    filenames is a list of the names of the non-directory files in dirpath.
+    Note that the names in the lists are just names, with no path components.
+    To get a full path (which begins with top) to a file or directory in
+    dirpath, do os.path.join(dirpath, name).
+ 
+    If optional arg 'topdown' is true or not specified, the triple for a
+    directory is generated before the triples for any of its subdirectories
+    (directories are generated top down).  If topdown is false, the triple
+    for a directory is generated after the triples for all of its
+    subdirectories (directories are generated bottom up).
+ 
+    When topdown is true, the caller can modify the dirnames list in-place
+    (e.g., via del or slice assignment), and walk will only recurse into the
+    subdirectories whose names remain in dirnames; this can be used to prune
+    the search, or to impose a specific order of visiting.  Modifying
+    dirnames when topdown is false is ineffective, since the directories in
+    dirnames have already been generated by the time dirnames itself is
+    generated.
+ 
+    By default errors from the os.listdir() call are ignored.  If
+    optional arg 'onerror' is specified, it should be a function; it
+    will be called with one argument, an os.error instance.  It can
+    report the error to continue with the walk, or raise the exception
+    to abort the walk.  Note that the filename is available as the
+    filename attribute of the exception object.
+ 
+    By default, os.walk does not follow symbolic links to subdirectories on
+    systems that support them.  In order to get this functionality, set the
+    optional argument 'followlinks' to true.
+ 
+    Caution:  if you pass a relative pathname for top, don't change the
+    current working directory between resumptions of walk.  walk never
+    changes the current directory, and assumes that the client doesn't
+    either.
+ 
+    Example:
+ 
+    import os
+    from os.path import join, getsize
+    for root, dirs, files in os.walk('python/Lib/email'):
+        print root, "consumes",
+        print sum([getsize(join(root, name)) for name in files]),
+        print "bytes in", len(files), "non-directory files"
+        if 'CVS' in dirs:
+            dirs.remove('CVS')  # don't visit CVS directories
+    """
+ 
+    from os.path import join, isdir, islink
+ 
+    # We may not have read permission for top, in which case we can't
+    # get a list of the files the directory contains.  os.path.walk
+    # always suppressed the exception then, rather than blow up for a
+    # minor reason when (say) a thousand readable directories are still
+    # left to visit.  That logic is copied here.
+    try:
+        # Note that listdir and error are globals in this module due
+        # to earlier import-*.
+        names = os.listdir(top)
+    except os.error, err:
+        if onerror is not None:
+            onerror(err)
+        return
+ 
+    dirs, nondirs = [], []
+    for name in names:
+        if isdir(join(top, name)):
+            dirs.append(name)
+        else:
+            nondirs.append(name)
+ 
+    if topdown:
+        yield top, dirs, nondirs
+    for name in dirs:
+        path = join(top, name)
+        if followlinks or not islink(path):
+            for x in _walk(path, topdown, onerror, followlinks):
+                yield x
+    if not topdown:
+        yield top, dirs, nondirs
+
+if __name__ == "__main__":
+    import sys
+    sys.exit(main())

scripts/setup_runtime_cache.sh

+#!/bin/sh
+#+
+#	Script to setup the runtime cache for the current project, release and $CMTCONFIG version.
+#
+#   The cache is created by running the:
+#
+#       cmt -requirements setup >& outfile
+#
+#   command to create a cache requirements file, and "cmt config" is run on this to create equivalent
+#   setup.[c]sh files. These files are saved in the:
+#
+#       <package>/$CMTCONFIG/runtime/cmt
+#
+#   creating them if necessary, and replacing older versions. 
+#
+#   On entry to this script, ${PWD} is set to the cmt directory of the relevant XXXRuntime package.
+#
+#	Author:-
+#	David Quarrie
+#-
+
+if [ ! -d ../$CMTCONFIG/runtime/cmt ]; then
+    \mkdir -p ../$CMTCONFIG/runtime/cmt
+fi
+if [ -f ../$CMTCONFIG/runtime/cmt/requirements ]; then
+    \rm -f ../$CMTCONFIG/runtime/cmt/requirements
+fi
+if [ ! -f ../$CMTCONFIG/runtime/cmt/version.cmt ]; then
+    echo "v1" > ../$CMTCONFIG/runtime/cmt/version.cmt
+fi
+cmt -requirements setup > ../$CMTCONFIG/runtime/cmt/requirements
+pushd ../$CMTCONFIG/runtime/cmt >& /dev/null
+cmt config >& /dev/null
+popd >& /dev/null
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.