B u `i ã@sbdgZddlZddlZddlZddlZddlZddlm Z ddl Zddl m Z Gdd„de ƒZ dS)ÚILMLicensedSystemCallSolveréN)ÚApplicationError)ÚSystemCallSolverc@s"eZdZdZdd„Zddd„ZdS) rzC A command line solver that launches executables licensed with ILM cKstjjjjj|f|ŽdS)z Constructor N)ÚpyomoÚoptÚsolverÚshellcmdrÚ__init__)ÚselfÚkwds©r ú;/tmp/pip-unpacked-wheel-n62dbgi3/pyomo/opt/solver/ilmcmd.pyr sz$ILMLicensedSystemCallSolver.__init__Fc Csœ|jr dStjjjj ||¡s"dStj d¡}|r˜y:|  ¡g}t j dd…dkr\|  d¡t j |¡\}}Wn,tk ršt  ¡d}td |ƒ‚YnXt j ¡xð| d ¡D]â}t d | ¡¡}t|ƒd kr,|dd kr,|ddkr,|dtj dd¡kr,|ddks(|ddks(dSdSt|ƒdkrl|ddkrl|ddkrl|ddkrhdSPq²t|ƒdkr²|ddkr²|d dkr²dSq²WdS)z! True if the solver is available TFZilmlistréÚwinz-batchéz7Could not execute the command: ilmtest Error message: Ú z[ ]+éÚtokensz reserved:éÚUSERNéÚnoneÚ0Ú availableztokens:éÚserverzDOWN.)Z_assert_availablerrrrrrÚcommonZ ExecutableÚpathÚsysÚplatformÚappendÚpyutilibÚ subprocessÚrunÚOSErrorÚexc_inforÚstdoutÚflushÚsplitÚreÚstripÚlenÚosÚenvironÚget) r Zexception_flagÚ executableÚcmdÚrcÚlogÚmsgÚlinerr r r r s8     B*$z%ILMLicensedSystemCallSolver.availableN)F)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rr r r r rs) Ú__all__r)rr,Z pyomo.commonrZpyutilib.subprocessr!Zpyomo.common.errorsrZpyomo.opt.solver.shellcmdrrr r r r Ú s