Package PyFoam :: Package Applications :: Module Execute
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Applications.Execute

 1  #  ICE Revision: $Id: Execute.py 7969 2007-09-20 21:43:14Z bgschaid $  
 2  """ 
 3  Application class that implements pyFoamExecute 
 4  """ 
 5   
 6  from PyFoamApplication import PyFoamApplication 
 7   
 8  from PyFoam.FoamInformation import changeFoamVersion 
 9   
10  from subprocess import call 
11   
12 -class Execute(PyFoamApplication):
13 - def __init__(self,args=None):
14 description=""" 15 Runs a command, but first switches the environment to a specific 16 OpenFOAM-version. Is of use for using wmake for a specific version 17 """ 18 19 PyFoamApplication.__init__(self, 20 nr=1, 21 args=args, 22 usage="%prog [options] <command> [arguments]", 23 description=description)
24
25 - def addOptions(self):
26 self.parser.add_option("--foamVersion", 27 dest="foamVersion", 28 default=None, 29 help="Change the OpenFOAM-version that is to be used")
30
31 - def run(self):
32 if self.opts.foamVersion!=None: 33 changeFoamVersion(self.opts.foamVersion) 34 else: 35 self.error("No Foam Version specified!") 36 37 result=call(self.parser.getArgs()) 38 if result!=0: 39 print "\nError result:",result
40