usr/lib/python2.7/site-packages/pip/_vendor/lockfile/mkdirlockfile.pyc000064400000006542147205645540022006 0ustar00 abc@`sddlmZmZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z defdYZdS(i(tabsolute_importtdivisionNi(tLockBaset LockFailedt NotLockedt NotMyLockt LockTimeoutt AlreadyLockedt MkdirLockFilecB`sMeZdZeddZddZdZdZdZ dZ RS(s"Lock file by creating a directory.cC`sKtj||||tjj|jd|j|j|jf|_ dS(ss >>> lock = MkdirLockFile('somefile') >>> lock = MkdirLockFile('somefile', threaded=False) s%s.%s%sN( Rt__init__tostpathtjoint lock_filethostnamettnametpidt unique_name(tselfR tthreadedttimeout((sF/usr/lib/python2.7/site-packages/pip/_vendor/lockfile/mkdirlockfile.pyR s  cC`s{|dk r|n|j}tj}|dk rL|dkrL||7}n|dkrad}ntd|d}xtrvytj|jWntk rXt j d}|j t j krBtj j|jrdS|dk r2tj|kr2|dkrtd|j q2td|j ntj|qstd|jqwXt|jdjdSqwWdS( Nig?i is&Timeout waiting to acquire lock for %ss%s is already lockedsfailed to create %stwb(tNoneRttimetmaxtTrueR tmkdirR tOSErrortsystexc_infoterrnotEEXISTR texistsRRRtsleepRtopentclose(RRtend_timetwaitterr((sF/usr/lib/python2.7/site-packages/pip/_vendor/lockfile/mkdirlockfile.pytacquires2       cC`sq|js"td|jn+tjj|jsMtd|jntj|jtj|j dS(Ns%s is not lockeds%s is locked, but not by me( t is_lockedRR R R RRtunlinktrmdirR (R((sF/usr/lib/python2.7/site-packages/pip/_vendor/lockfile/mkdirlockfile.pytreleaseAs  cC`stjj|jS(N(R R R R (R((sF/usr/lib/python2.7/site-packages/pip/_vendor/lockfile/mkdirlockfile.pyR(IscC`s|jotjj|jS(N(R(R R R R(R((sF/usr/lib/python2.7/site-packages/pip/_vendor/lockfile/mkdirlockfile.pyt i_am_lockingLs cC`shtjj|jrdx9tj|jD]%}tjtjj|j|q(Wtj|jndS(N(R R R R tlistdirR)R R*(Rtname((sF/usr/lib/python2.7/site-packages/pip/_vendor/lockfile/mkdirlockfile.pyt break_lockPs#N( t__name__t __module__t__doc__RRR R'R+R(R,R/(((sF/usr/lib/python2.7/site-packages/pip/_vendor/lockfile/mkdirlockfile.pyR s &   (t __future__RRRR RRtRRRRRRR(((sF/usr/lib/python2.7/site-packages/pip/_vendor/lockfile/mkdirlockfile.pyts     .