1   
 2   
 3   
 4  """ 
 5   Interface for configuring pre/post icetray scripts 
 6   
 7   copyright  (c) 2005 the icecube collaboration 
 8   
 9   @version: $Revision: $ 
10   @date: $Date: $ 
11   @author: Juan Carlos Diaz Velez <juancarlos@icecube.wisc.edu> 
12  """ 
13   
14  import os 
15  import re 
16  import sys 
17  import math 
18  import dircache 
19  import time 
20  import string 
21  import shutil 
22  import cPickle 
23  from ipmodule import IPBaseClass 
24  from iceprod.core import functions 
25  import logging 
26   
28          """ 
29          SETUP JAVA ENVIRONMENT 
30      find any java installed on system 
31          """ 
32   
34              IPBaseClass.__init__(self) 
35              self.AddParameter( 
36                          'SearchPath', 
37                          'Colon separated list of directories in which to search',  
38                          '$JAVA_HOME:/usr/java:/usr/local/java') 
39              self.logger = logging.getLogger('iceprod::RenameFile') 
 40   
41   
43              if not IPBaseClass.Execute(self,stats): return 0 
44              javasearchpath = self.GetParameter('SearchPath') 
45              java = functions.findjava(javasearchpath) 
46              if not java:  
47                 raise Exception,"java not found in "+ javasearchpath  
48              functions.myputenv('JAVA_HOME',java[0]) 
49              print expandvars("using java in $JAVA_HOME") 
50              return 0 
  51