From bd12a2bcc5521d82d9436bed24815de0c5d67f7c Mon Sep 17 00:00:00 2001
From: Vakhtang Tsulaia <Vakhtang.Tsulaia@cern.ch>
Date: Tue, 29 Nov 2011 01:44:21 +0100
Subject: [PATCH] Another fix for athenash (Interpreters-00-00-13)

---
 .../Interpreters/cmt/requirements             |  5 ++
 .../Interpreters/share/athenash.py            | 78 +++++++++++++++++++
 AtlasGeometryCommon/Interpreters/share/physh  |  4 +
 .../Interpreters/share/totalphysh             |  4 +
 4 files changed, 91 insertions(+)
 create mode 100755 AtlasGeometryCommon/Interpreters/cmt/requirements
 create mode 100755 AtlasGeometryCommon/Interpreters/share/athenash.py
 create mode 100755 AtlasGeometryCommon/Interpreters/share/physh
 create mode 100755 AtlasGeometryCommon/Interpreters/share/totalphysh

diff --git a/AtlasGeometryCommon/Interpreters/cmt/requirements b/AtlasGeometryCommon/Interpreters/cmt/requirements
new file mode 100755
index 000000000000..5b436dcb6739
--- /dev/null
+++ b/AtlasGeometryCommon/Interpreters/cmt/requirements
@@ -0,0 +1,5 @@
+package Interpreters
+
+use	AtlasPolicy	AtlasPolicy-01-*
+
+apply_pattern declare_scripts files="physh totalphysh athenash.py"
diff --git a/AtlasGeometryCommon/Interpreters/share/athenash.py b/AtlasGeometryCommon/Interpreters/share/athenash.py
new file mode 100755
index 000000000000..e33cc36da3b3
--- /dev/null
+++ b/AtlasGeometryCommon/Interpreters/share/athenash.py
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+
+"""date"      # executable for the shell, but a string block to python 
+exec `which python` -t "$0" "$@"               # exec, as required for gdb 
+"""           # python execution starts here, the shell never reaches this
+
+
+__version__ = '3.0.0'
+__author__  = 'Joe Boudreau (boudreau@pitt.edu) based upon work of Wim Lavrijsen (WLavrijsen@lbl.gov)'
+__doc__     = 'No Doc.  Sorry'
+
+import sys, os
+import getopt, string
+
+
+runBatch=1
+
+# start-up athfile server early on to prevent race-conditions later on...
+try:
+   import PyUtils.AthFile as af
+   af.msg.debug('starting athfile server...')
+except ImportError:
+   pass
+   
+### python interpreter configuration -----------------------------------------
+if not os.getcwd() in sys.path:
+   sys.path = [ os.getcwd() ] + sys.path
+
+if not '' in sys.path:
+   sys.path = [ '' ] + sys.path
+
+
+### logging and messages -----------------------------------------------------
+from AthenaCommon.Logging import *
+
+### file inclusion and tracing -----------------------------------------------
+from AthenaCommon.Include import Include, IncludeError, include
+include.setShowIncludes( False )
+
+### gaudi --------------------------------------------------------------------
+from GaudiPython import *
+
+from AthenaCommon.Configurable import *
+from AthenaCommon.OldStyleConfig import *
+from AthenaCommon.Constants import *
+
+preconfig = "AthenaCommon"
+### Athena configuration -----------------------------------------------------
+theApp = iService( "ApplicationMgr" )       # proxy
+theApp.StatusCodeCheck = True
+theApp.Dlls += [ 'AthenaServices' ]
+include( "%s/Bootstrap.py" % preconfig )
+
+## create the application manager and start in a non-initialised state
+from AthenaCommon.AppMgr import theApp, ToolSvc, ServiceMgr, theAuditorSvc
+
+
+## basic job configuration
+include( "AthenaCommon/Atlas.UnixStandardJob.py" )
+include.block( "AthenaCommon/Atlas.UnixStandardJob.py" )
+
+
+EventLoopMgr = iService( 'EventLoopMgr' )
+AthenaEventLoopMgr = EventLoopMgr                       # for historic reasons
+
+### execution ----------------------------------------------------------------
+from AthenaCommon.ResourceLimits import SetMaxLimits
+SetMaxLimits()
+del SetMaxLimits
+
+include( sys.argv[1] )
+try:
+   theApp.run()     # runs until theApp.EvtMax events reached
+except RuntimeError, e:
+   print 'RuntimeError:', str(e)
+theApp.exit()    # exits program, yields theApp._exitstate on shell    
+
diff --git a/AtlasGeometryCommon/Interpreters/share/physh b/AtlasGeometryCommon/Interpreters/share/physh
new file mode 100755
index 000000000000..f943877b3cf2
--- /dev/null
+++ b/AtlasGeometryCommon/Interpreters/share/physh
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+import sys,os
+
+os.execvpe('athenash.py', sys.argv ,os.environ)
diff --git a/AtlasGeometryCommon/Interpreters/share/totalphysh b/AtlasGeometryCommon/Interpreters/share/totalphysh
new file mode 100755
index 000000000000..8f9f44ba948f
--- /dev/null
+++ b/AtlasGeometryCommon/Interpreters/share/totalphysh
@@ -0,0 +1,4 @@
+#!/bin/bash
+totalview  python -a  `which athenash.py` $@
+
+
-- 
GitLab