Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/windows.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��c@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZejZej
Z
ejZejZejZejZejZejZejZejZejjZejZejZejZdZddd�Zejje_defd��YZee	j �e	_!e	_ d�Z"d	�Z#d
�Z$d�Z%d�Z&dd
�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1da2d�Z3d�Z4dd�Z5d�Z6d�Z7d�Z8e9ej:ej;g�Z<d�Z=dd�Z>dd�Z?d �Z@eAd!�ZBd"�ZCd#�ZDd$�ZEd%�ZFd&efd'��YZGddd(�ZHeIZJd)�ZKd*�ZLdS(+i�(t_NitrcCsPytj|||�SWn2tk
rK}t|jd||jf��nXdS(Ns%s: %s(tosutilt	posixfiletWindowsErrortIOErrorterrnotstrerror(tnametmodet	bufferingterr((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyRst	winstdoutcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s3stdout on windows misbehaves if sent through a pipecCs
||_dS(N(tfp(tselfR
((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt__init__)scCst|j|�S(N(tgetattrR
(Rtkey((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt__getattr__,scCs)y|jj�Wntk
r$nXdS(N(R
tcloseR(R((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyR/s
cCs�y_d}t|�}d}d|_x7||kr]||}|jj|||!�|}q'WWnDtk
r�}|jdkr��n|j�ttjd��nXdS(Ni�isBroken pipe(tlent	softspaceR
twriteRRRtEPIPE(Rtstlimittltstarttendtinst((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyR5s	

cCs_y|jj�SWnGtk
rZ}|jtjkr;�n|j�ttjd��nXdS(NsBroken pipe(R
tflushRRtEINVALRR(RR((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyRGs
(t__name__t
__module__t__doc__RRRRR(((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyR&s				cCsFytj�ddkSWn'tk
rAdtjjdd�kSXdS(s+return true if run on windows 95, 98 or me.iitcommandtcomspectN(tsystgetwindowsversiontAttributeErrortostenvirontget(((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt
_is_win_9xRs
cCst�S(N(R,(((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt
openhardlinksYscCs.|d}|ddkr*|dd!}n|S(s<parses the output produced by patch and returns the filenameiit`ii�((toutput_linetpf((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytparsepatchoutput\s
c	CsWd|j�krdpd}|r4d||fp7|}|rSd|||fpV|S(s$Build argument list for ssh or Plinktplinks-Ps-ps%s@%ss%s %s %s(tlower(tsshcmdthosttusertporttpflagtargs((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytsshargscscCsdS(N((tfRtx((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytsetflagsiscCsdS(N((tsrctdstR	((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytcopymodelscCstS(N(tFalse(tpath((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt	checkexecoscCstS(N(RA(RB((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt	checklinkrscCsJt|dd�}|dk	rF|�dkrFtj|�tj�ndS(Ntfilenoi(RtNonetmsvcrttsetmodeR)tO_BINARY(tfdtfno((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt	setbinaryuscCs|jtjd�S(Nt/(treplaceR)tsep(RB((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytpconvert|scCs|jdd�S(NRMs\(RN(RB((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt	localpathscCsttjj|��S(N(RPR)RBtnormpath(RB((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyRR�scCs
tj|�S(N(tencodingtupper(RB((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytnormcase�scCs"tjjttjj|���S(sX
    Returns the true, canonical file system path equivalent to the given
    path.
    (R)RBRRRUtrealpath(RB((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyRV�scCstS(N(RA(ts1ts2((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytsamestat�scCs2tdkrtjd�andtjd|�S(Ns(\\*)("|\\$)s"%s"s\1\1\\\2(t_quotereRFtretcompiletsub(R((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt
shellquote�scCstjdkrd|dS|S(s4Build a command string suitable for os.popen* calls.iiit"(iii(R&tversion_info(tcmd((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytquotecommand�scCs'|dtj7}tjt|�|�S(Ns 2> %s(R)tdevnulltpopenRb(R#R	((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyRd�scCstd�||fS(Nsexited with status %d(R(tcode((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytexplainexit�scCstS(N(tTrue(tst((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytisowner�scstjjdd�}g|j�jtj�D]}|^q.�tjj|�dj��krndg�n�fd�}tj|kr�||�SxTtjjdd�jtj�D]1}|tjj	||��}|dk	r�|Sq�W|tjjtjj|���S(s*Find executable for command searching like cmd.exe does.
    If command is a basename then PATH is searched for command.
    PATH isn't searched if command is an absolute or relative path.
    An extension from PATHEXT is found and added if not present.
    If command isn't found None is returned.tPATHEXTs.COM;.EXE;.BAT;.CMDiR%cs5x.�D]&}||}tjj|�r|SqWdS(s:Will append extension (if needed) and return existing fileN(R)RBtexistsRF(tpathcommandtextt
executable(tpathexts(s5/sys/lib/python2.7/site-packages/mercurial/windows.pytfindexisting�s


tPATHN(
R)R*R+R3tsplittpathsepRBtsplitextROtjoinRFt
expandusert
expandvars(R#tpathextRmRpRBRn((Ros5/sys/lib/python2.7/site-packages/mercurial/windows.pytfindexe�s+"
(ccs:i}tj}x$|D]}t|�}tjj|�\}}|sOd}n|j|d�}|dkr!yYtgt	j
|t�D]6\}}}	||	j�t
kr�t|�|	f^q��}
WnCtk
r}|jdtjtjtjfkr�ni}
nX|j||
�}n|j|d�VqWdS(s�Stat each file in files. Yield each stat, or None if a file
    does not exist or has a type we don't care about.

    Cluster and cache stat per directory to minimize number of OS stat calls.t.iN(tstattS_IFMTRUR)RBRrR+RFtdictRtlistdirRgtst_modet_wantedkindstOSErrorRtENOENTRtENOTDIRt
setdefault(tfilestdircachetgetkindtnftdirtbasetcachetntkRtdmapR((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt	statfiles�s(	
	4
cCsdS(siReturn the name of the user with the given uid.

    If uid is None, return the name of the current user.N(RF(tuid((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytusername�scCsdS(skReturn the name of the group with the given gid.

    If gid is None, return the name of the current group.N(RF(tgid((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt	groupname�scCs�tj|�rdStj|�tjj|�\}}|sYtjj|�\}}nxg|r�|r�y$tj|�r~dStj|�Wnttfk
r�PnXtjj|�\}}q\WdS(s�special version of os.removedirs that does not remove symlinked
    directories or junction points if they actually contain filesN(RR~R)trmdirRBRrt
ValueErrorR�(Rtheadttail((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt_removedirss
cCstyt|�Wn1tk
rA}|o5|jtjksB�qBnXyttjj|��Wntk
ronXdS(s.unlink and remove the directory if it is emptyN(tunlinkR�RR�R�R)RBtdirname(R;t
ignoremissingte((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt
unlinkpaths

cCs`ytj||�WnEtk
r[}|jtjkr>�nt|�tj||�nXdS(s=atomically rename file src to dst, replacing dst if it existsN(R)trenameR�RtEEXISTR�(R>R?R�((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyR�#s
cCstjgtjd S(Ni(R&Rntargv(((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytgethgcmd-scCs
t�dS(N(tKeyError(R((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytgroupmembers0scCstS(N(RA(R;((s5/sys/lib/python2.7/site-packages/mercurial/windows.pytisexec4st	cachestatcBseZd�Zd�ZRS(cCsdS(N((RRB((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyR8scCstS(N(RA(R((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt	cacheable;s(R R!RR�(((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyR�7s	cCs�|dkr!tjtjf}n!t|ttf�sB|f}nx^|D]V}y<tjtj||�|�d}t	j
|jd��SWqItk
r�qIXqIWdS(s* Look up a key/value name in the Windows registry.

    valname: value name. If unspecified, the default value for the key
    is used.
    scope: optionally specify scope for registry lookup, this can be
    a sequence of scopes to look up in order. Default (CURRENT_USER,
    LOCAL_MACHINE).
    isUTF-8N(
RFt_winregtHKEY_CURRENT_USERtHKEY_LOCAL_MACHINEt
isinstancetlistttupletQueryValueExtOpenKeyRSttolocaltencodetEnvironmentError(RtvalnametscopeRtval((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt	lookupreg>s	
"
cCstS(s(check whether a stat result is a symlink(RA(Rh((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt
statislinkUscCstS(s1check whether a stat result is an executable file(RA(Rh((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt
statisexecYs(Mti18nRRRSRRGR)R[R{R&R�twin32texecutablepathtgetusert
hidewindowtmakedirtnlinkstoslinkt
samedevicetsamefiletsetsignalhandlert
spawndetachedRBRrt	termwidthttestpidR�tumaskRR"tobjectRtstdoutt
__stdout__R,R-R1R:R=RFR@RCRDRLRPRQRRRURVRYRZR^RbRdRfRiRytsettS_IFREGtS_IFLNKR�R�R�R�R�RAR�R�R�R�R�R�R�RgtexpandglobsR�R�(((s5/sys/lib/python2.7/site-packages/mercurial/windows.pyt<module>svT													*																						
	
				

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].