ó .Åt_c@srdZddlmZmZddlZddlZddlZddlZddl Z de fd„ƒYZ dS(s‚ Utils - miscellaneous utilities for the VDO manager $Id: //eng/vdo-releases/magnesium/src/python/vdo/vdomgmnt/Utils.py#1 $ iÿÿÿÿ(t CommandErrort runCommandNtUtilscBsŸeZdZdZdeZdeZdeZdeZed„ƒZ ed„ƒZ ed„ƒZ e d„ƒZ ed„ƒZed„ƒZd„ZRS( s'Utils contains miscellaneous utilities.icCs;tjjg|jtjƒD]}tjj|ƒ^qƒS(sTakes a path or a colon-separated list of paths and makes each one an absolute path. Paths that don't exist are left alone.(tostpathseptjointsplittpathtabspath(Rtp((s6/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pyt abspathPath-scCstjdctj|7scCsvyAtj|tjƒx'tr?tjdƒtj|dƒqWWn.tk rq}|jtj krr|‚qrnXdS(sŠKills a process and waits for it to die. Arguments: pid: process id to kill Throws: Any unexpected OS error iiN( RtkilltsignaltSIGTERMtTruettimetsleeptOSErrorterrnotESRCH(tclstpidte((s6/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pyt killProcessDs   cCs||kr|S|S(s#Returns the maximum of two numbers.((tatb((s6/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pytmaxNumWs cCstjj|ƒS(sµFinds the full path to a command. Arguments: cmd (str): The command to search for. Returns: The full path as a string, or None if the command is not found. (t distutilstspawntfind_executable(tcmd((s6/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pytwhich_s cCsdS(N((tself((s6/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pyt__init__ms(t__name__t __module__t__doc__tKiBtMiBtGiBtTiBtPiBt staticmethodR R Rt classmethodRRR$R&(((s6/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pyR!s     ( R)tutilsRRtdistutils.spawnR RRRRtobjectR(((s6/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pyts