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

Source Code for Module PyFoam.Applications.Execute

 1  #  ICE Revision: $Id: Execute.py 8344 2008-01-01 15:46:26Z 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 exactNr=False, 22 args=args, 23 usage="%prog [options] <command> [arguments]", 24 description=description)
25
26 - def addOptions(self):
27 self.parser.add_option("--foamVersion", 28 dest="foamVersion", 29 default=None, 30 help="Change the OpenFOAM-version that is to be used")
31
32 - def run(self):
33 if self.opts.foamVersion!=None: 34 changeFoamVersion(self.opts.foamVersion) 35 else: 36 self.error("No Foam Version specified!") 37 38 result=call(self.parser.getArgs()) 39 if result!=0: 40 print "\nError result:",result
41