def bx822Get_sendingFieldsPipelineLoad( bxoId, sr, msg, ): """ ** Look for BX-Send-WithAcctName or BX-Send-WithBaseDir, and based on those prep the Bx822 fields. """ opOutcome = icm.OpOutcome() if 'BX-Send-WithAcctName' in msg: controlProfile = msg['BX-Send-WithControlProfile'] outMailAcct = msg['BX-Send-WithAcctName'] return (msgSendingPipelineLoadFromAcct( bxoId, sr, msg, controlProfile, outMailAcct, )) elif 'BX-Send-WithBaseDir' in msg: acctBaseDir = msg['BX-Send-WithBaseDir'] return (msgSendingPipelineLoadFromAcctBaseDir( msg, acctBaseDir, )) else: return opOutcome.set(opResults='INCOMPLETE')
def cmnd(self, interactive=False, # Can also be called non-interactively inMailAcct=None, # or IIF Parameter ): """ """ myName=self.myName() G = icm.IcmGlobalContext() thisOutcome = icm.OpOutcome(invokerName=myName) if interactive: if not self.cmndLineValidate(outcome=thisOutcome): return(thisOutcome) if not inMailAcct: if not interactive: return icm.eh_problem_usageError( thisOutcome, "Missing Non-Interactive Arg (inMailAcct)", ) inMailAcct = G.usageParams.inMailAcct outcome = icm.subProc_bash("""echo Preparing the package""").log() if outcome.isProblematic(): return(icm.EH_badOutcome(outcome)) return thisOutcome.set( opError=icm.OpError.Success, opResults=None, )
def cmnd( self, interactive=False, # Can also be called non-interactively argsList=None, # or Args-Input ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome effectiveArgsList = G.icmRunArgsGet().cmndArgs else: effectiveArgsList = argsList callParamsDict = {} if not icm.cmndCallParamsValidate( callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome ####+END: serviceUrl = serviceUrlDefault(effectiveArgsList[0]) myName = self.myName() thisOutcome = icm.OpOutcome(invokerName=myName) screenstudioClient = ScreenstudioWebClient(serviceUrl=serviceUrl) screenstudioClient.recordingStop() return thisOutcome
def cmnd( self, interactive=False, # Can also be called non-interactively argsList=None, # or Args-Input ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome effectiveArgsList = G.icmRunArgsGet().cmndArgs else: effectiveArgsList = argsList callParamsDict = {} if not icm.cmndCallParamsValidate( callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome ####+END: myName = self.myName() thisOutcome = icm.OpOutcome(invokerName=myName) serviceUrl = effectiveArgsList[0] try: response = requests.get(serviceUrl) except: return thisOutcome # .error icm.ANN_here(response) icm.ANN_here(response.status_code) icm.ANN_here(response.text) return thisOutcome
def cmnd( self, interactive=False, # Can also be called non-interactively argsList=[], # or Args-Input ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome effectiveArgsList = G.icmRunArgsGet().cmndArgs else: effectiveArgsList = argsList callParamsDict = {} if not icm.cmndCallParamsValidate( callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome ####+END: myName = self.myName() thisOutcome = icm.OpOutcome(invokerName=myName) print(f"ICM-INFO: {G.icmInfo()}") # NOTYET, Why doesn't this work for eachArg in effectiveArgsList: icm.ANN_here("{}".format(eachArg)) print((icm.__file__)) print("sys.path={sys.path}") import importlib importlib.import_module('unisos.icm') print("foundModuleAndOrigin={}".format( (importlib.util.find_spec('unisos.icm')))) # import imp # print((imp.find_module('unisos/icm'))) @ucf.runOnceOnly def echo(str): print(str) echo("first") echo("second") # Should not run return thisOutcome
def cmnd( self, interactive=False, # Can also be called non-interactively argsList=[], # or Args-Input ): cmndOutcome = self.getOpOutcome() if interactive: if not self.cmndLineValidate(outcome=cmndOutcome): return cmndOutcome effectiveArgsList = G.icmRunArgsGet().cmndArgs else: effectiveArgsList = argsList callParamsDict = {} if not icm.cmndCallParamsValidate( callParamsDict, interactive, outcome=cmndOutcome): return cmndOutcome cmndArgsSpecDict = self.cmndArgsSpec() if not self.cmndArgsValidate( effectiveArgsList, cmndArgsSpecDict, outcome=cmndOutcome): return cmndOutcome ####+END: myName = self.myName() thisOutcome = icm.OpOutcome(invokerName=myName) print(G.icmInfo) for eachArg in effectiveArgsList: icm.ANN_here("{}".format(eachArg)) print((icm.__file__)) print(sys.path) import imp print((imp.find_module('unisos/icm'))) @ucf.runOnceOnly def echo(str): print(str) echo("first") echo("second") # Should not run return thisOutcome
def inFilesListForOne(mainLatexFile): thisPrefix, thisExtension = os.path.splitext(mainLatexFile) thisOutcome = icm.OpOutcome(invokerName=G.icmMyFullName()) thisOutcome = icm.subProc_bash( """xelatex -recorder {mainLatexFile}""".format( mainLatexFile=mainLatexFile), stdin=None, outcome=thisOutcome, ) #.out() if thisOutcome.isProblematic(): return (icm.EH_badOutcome(thisOutcome)) thisOutcome = icm.subProc_bash( """egrep '(^INPUT )([a-z|A-Z]|\.)' {thisPrefix}.fls | sort | uniq | egrep -v 'aux$' | cut -d ' ' -f 2""" .format(thisPrefix=thisPrefix), stdin=None, outcome=thisOutcome, ) #.out() if thisOutcome.isProblematic(): return (icm.EH_badOutcome(thisOutcome)) inFilesList = list() for each in thisOutcome.stdout.splitlines(): thisPrefix, thisExtension = os.path.splitext(each) if thisExtension in [ ".vrb", ".out", ".bbl", ".nav", ".cut", ".toc", ".lof", ]: continue else: inFilesList.append(each) return inFilesList
def msgSendingPipelineLoadFromAcctBaseDir( msg, acctBaseDir, ): """ ** Read File Params for mailAcct and set X822-MSP params accordingly """ opOutcome = icm.OpOutcome() #print acctBaseDir #G = icm.IcmGlobalContext() outcome = icm.FP_readTreeAtBaseDir().cmnd( interactive=False, FPsDir=os.path.join(acctBaseDir, 'access'), ) fp_access_dict = outcome.results outcome = icm.FP_readTreeAtBaseDir().cmnd( interactive=False, FPsDir=os.path.join(acctBaseDir, 'controllerInfo'), ) #fp_controllerInfo_dict = outcome.results outcome = icm.FP_readTreeAtBaseDir().cmnd( interactive=False, FPsDir=os.path.join(acctBaseDir, 'submission'), ) fp_submission_dict = outcome.results envelopeAddr = fp_submission_dict["envelopeAddr"].parValueGet() msgOut.envelopeAddrSet( msg, mailBoxAddr=envelopeAddr, # Mandatory ) sendingMethod = fp_submission_dict["sendingMethod"].parValueGet() if msgOut.sendingMethodSet(msg, sendingMethod).isProblematic(): return icm.EH_badLastOutcome() if sendingMethod == msgOut.SendingMethod.inject: return opOutcome # # So, It is a submission # # NOTYET, below should be split and use # msgOut.submitParamsNOT() # try: mtaRemHost = fp_access_dict["mtaRemHost"].parValueGet() except KeyError: return icm.eh_problem_usageError(opOutcome, "Missing BX-MTA-Rem-Host") try: userName = fp_access_dict["userName"].parValueGet() except KeyError: return icm.eh_problem_usageError(opOutcome, "Missing BX-MTA-Rem-User") try: userPasswd = fp_access_dict["userPasswd"].parValueGet() except KeyError: return icm.eh_problem_usageError(opOutcome, "Missing BX-MTA-Rem-Passwd") try: remProtocol = fp_access_dict["mtaRemProtocol"].parValueGet() except KeyError: return icm.eh_problem_usageError(opOutcome, "Missing BX-MTA-Rem-Protocol") try: remPortNu = fp_access_dict["mtaRemPortNu"].parValueGet() except KeyError: remPortNu = None msgOut.submitParams( msg, mtaRemProtocol=remProtocol, # smtp mtaRemHost=mtaRemHost, # Remote Host To Submit to (could be localhost) mtaRemPort=remPortNu, mtaRemUser=userName, mtaRemPasswd=userPasswd, mtaRemCerts=None, ) return opOutcome