Current File : //usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pyo
�
.�t_c@srdZddlmZmZddlZddlZddlZddlZddl	Z	de
fd��YZdS(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��Ze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.pytabspathPath-scCstjdctj|7<dS(s�Appends a directory or directories to the current PATH.

    Arguments:
      path (str): A directory or colon-separated list of directories.
    tPATHN(RtenvironR(R((s6/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pytappendToPath4scCs|dko||d@dkS(s0Returns True iff its argument is a power of two.ii((ti((s6/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Utils.pytisPowerOfTwo>scCsvyAtj|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.pytkillProcessDs		
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
RtclassmethodRRR$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.pyt<module>s