MCPcopy Create free account
hub / github.com/ActiveState/code / submitnow

Function submitnow

recipes/Python/577454_Extract_expexecute/recipe-577454.py:210–235  ·  view source on GitHub ↗

Expand and submit command

(pArgs, pFilePath, pSearchPath, pCount, pList=False, pExtract=False, pVerbose=False, pWidth=15)

Source from the content-addressed store, hash-verified

208 return lCommand
209
210def submitnow(pArgs, pFilePath, pSearchPath, pCount, pList=False, pExtract=False, pVerbose=False, pWidth=15):
211 'Expand and submit command'
212 if pVerbose:
213 print 'pb.py File path: ', pFilePath
214 print 'pb.py Search path:', pSearchPath
215 print 'pb.py Arguments: ', pArgs
216
217 lCommand = Expand(pArgs, pFilePath, pSearchPath, pCount, pList=pList, pWidth=pWidth, pVerbose=pVerbose)
218# ---- Any macro not expanded will be assumed to be an environment variable
219# If %...% had been used it would have been replaced when pb.py was run
220 lCommand = lCommand.replace('{}',' ') # <-- may want to do something else
221 lCommand = lCommand.replace('{', '%')
222 lCommand = lCommand.replace('}', '%')
223
224# ---- Complete execution
225 if pList: # List only
226 pass
227 elif len(lCommand) == 0: # Expansion failed
228 print 'pb.py Expansion failed'
229 elif pExtract: # Expand command only
230 print lCommand
231 else: # Submit command
232 lCommand = '"' + lCommand + '"'
233 if pVerbose:
234 print 'pb.py Submitting: ', lCommand
235 subprocess.Popen(lCommand, shell=True)
236
237def setenviron(pValue, pFileName):
238 'Set environment variable'

Callers 2

recipe-577454.pyFile · 0.70
recipe-577439.pyFile · 0.50

Calls 2

ExpandFunction · 0.70
replaceMethod · 0.45

Tested by

no test coverage detected