diff --git a/Tools/PathResolver/CMakeLists.txt b/Tools/PathResolver/CMakeLists.txt index b9a82329bcd82a2ac2b4af4683c1f4288f215941..159c1687958b34dc8d58f68b5bd8c2dcc1cec97a 100644 --- a/Tools/PathResolver/CMakeLists.txt +++ b/Tools/PathResolver/CMakeLists.txt @@ -1,4 +1,4 @@ -# $Id: CMakeLists.txt 725452 2016-02-22 09:43:15Z krasznaa $ +# $Id: CMakeLists.txt 740930 2016-04-18 08:46:48Z will $ # # CMake configuration file for the PathResolver package. # @@ -35,6 +35,9 @@ atlas_add_dictionary( PathResolverDict # Install files from the package: atlas_install_python_modules( python/*.py ) +# Install showReleaseNotes.py script +#FIXME: TODO + # Set up a helper environment variable for the test(s): set( _dpath "${CMAKE_CURRENT_SOURCE_DIR}/test" ) set( _dpath "${CMAKE_CURRENT_SOURCE_DIR}/test/B:${_dpath}" ) diff --git a/Tools/PathResolver/PathResolver/selection.xml b/Tools/PathResolver/PathResolver/selection.xml index 746011d3f2e526a6c0916b29588107b13f9bb87a..dae5387ef08b94b3a9892e87ac8ae0cc5a7b1c0c 100644 --- a/Tools/PathResolver/PathResolver/selection.xml +++ b/Tools/PathResolver/PathResolver/selection.xml @@ -1,4 +1,5 @@ <lcgdict> <function name="PathResolverFindCalibFile" /> <function name="PathResolverFindCalibDirectory" /> + <function name="PathResolverSetOutputLevel" /> </lcgdict> diff --git a/Tools/PathResolver/Root/PathResolver.cxx b/Tools/PathResolver/Root/PathResolver.cxx index 6141d389580ad18245f8d5ab4f375ca41016c50d..5c6e2f5de15eb259b6abd01f7a9ad231efd83399 100644 --- a/Tools/PathResolver/Root/PathResolver.cxx +++ b/Tools/PathResolver/Root/PathResolver.cxx @@ -35,6 +35,7 @@ bool PathResolver::m_setLevel=false; asg::AsgMessaging& PathResolver::asgMsg() { + if(!m_setLevel) setOutputLevel(MSG::INFO); static asg::AsgMessaging asgMsg("PathResolver"); return asgMsg; } diff --git a/Tools/PathResolver/cmt/requirements b/Tools/PathResolver/cmt/requirements index 77cd90605f82d45fcd09248188aee14ce45e385a..4f208c245f5a2dc88e1a4fa089064bee08a8940d 100644 --- a/Tools/PathResolver/cmt/requirements +++ b/Tools/PathResolver/cmt/requirements @@ -45,6 +45,7 @@ branches python apply_pattern declare_python_modules files="*.py" +apply_pattern declare_scripts files=" -s=$(PathResolver_root)/python showReleaseNotes.py" #Next three lines kept for possible future developments #macro_append pp_cppflags " '-DPACKAGE_NAME=$(q2)$(package)$(q2)' '-DPACKAGE_OFFSET=$(q2)$($(package)_offset)$(q2)' " diff --git a/Tools/PathResolver/python/PathResolver.py b/Tools/PathResolver/python/PathResolver.py index 4ebe3ae8a95a4d3b2d2f885413d27587b0912d49..2e8ea24d809c09e2ac470bd0e839ad424ece3fe2 100644 --- a/Tools/PathResolver/python/PathResolver.py +++ b/Tools/PathResolver/python/PathResolver.py @@ -5,10 +5,22 @@ #from PathResolver import PathResolver #PathResolver.FindCalibFile("blah") +#if working in athena release, we will need to start the ApplicationMgr so that the appropriate MessageSvc is created +try: + #check if Gaudi already started + from GaudiPython.Bindings import _gaudi as GaudiAppMgr + if GaudiAppMgr==None: + print "PathResolver: Starting Gaudi for access to correct instance of MessageSvc" + from GaudiPython import AppMgr + AppMgr() #note this is not the same thing as 'theApp' in joboptions, but 'theApp' will use this + #the line above starts the application mgr, and _gaudi will become set to that +except ImportError: + pass import cppyy cppyy.loadDict('libPathResolver') cppyy.loadDict('libPathResolverDict') #why do we have to load both the library and the dict :-( To be fixed by ROOT... FindCalibFile = cppyy.gbl.PathResolverFindCalibFile FindCalibDirectory = cppyy.gbl.PathResolverFindCalibDirectory +SetOutputLevel = cppyy.gbl.PathResolverSetOutputLevel diff --git a/Tools/PathResolver/python/showReleaseNotes.py b/Tools/PathResolver/python/showReleaseNotes.py new file mode 100755 index 0000000000000000000000000000000000000000..c3ec1b65e879d790b4a9d23819102ee4c3da46c9 --- /dev/null +++ b/Tools/PathResolver/python/showReleaseNotes.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# @file showReleaseNotes.py +# @purpose Display important notes/announcments (if any) about the current release +# @author Will Buttinger +# @date April 2016 + + +def main(): + import os + #we don't use the 'from PathResolver import PathResolver' because that will force Gaudi ApplicationMgr to display + #Until we have a way to 'silently' start the applicationmgr, we will do it the 'bad' way + import cppyy + cppyy.loadDict('libPathResolver') + cppyy.loadDict('libPathResolverDict') + FindCalibFile = cppyy.gbl.PathResolverFindCalibFile + cppyy.gbl.PathResolverSetOutputLevel(6) #suppress all possible warnings/errors + + notesFile = FindCalibFile("dev/ReleaseNotes/%s/%s" % (os.environ['AtlasProject'],os.environ['AtlasVersion'])) + if notesFile=="": return 0 #no notes to display + + with open(notesFile) as f: + print f.read() + + + + +if __name__ == "__main__": + import sys + sys.exit(main())