Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/posix.pyc

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


�
�c@s�ddklZddkZddkZddkZddkZddkZddkZddkZddk	Z	ddk
Z
eZdZ
eiiZeiiZeZeid�Zeie�d�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zeidjo
d�Z n
eii Z d�Z!d�Z"dd�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+dd�Z-dd�Z.dS( i�(t_Ns	/dev/nullicCstS(s@return true if it is safe to hold open file handles to hardlinks(tTrue(((s"/sys/lib/python/mercurial/posix.pyt
openhardlinkssc
Cs�tii|d�g}tii|d�}y^|ig}ti|�D]6\}}|id�o|tii||�qJqJ~�Wntj
onX|S(Nthgrcshgrc.ds.rc(tostpathtjointextendtosutiltlistdirtendswithtOSError(Rtrcstrcdirt_[1]tftkind((s"/sys/lib/python/mercurial/posix.pytrcfiless
8cCsjg}tttdg��djo.|ittiitid�d��n|itd��|S(Ntargvis/../etc/mercurials/etc/mercurial(	tlentgetattrtsysRRRRtdirnameR(R((s"/sys/lib/python/mercurial/posix.pyt
system_rcpath$scCstiid�gS(Ns~/.hgrc(RRt
expanduser(((s"/sys/lib/python/mercurial/posix.pytuser_rcpath-scCs�|d}tiidjo&|ddjo|dd!}q�n?|id�o.|id�od|jo|dd!}n|S(	s<parses the output produced by patch and returns the filenameitOpenVMSit`ii�t't (RRtplatformt
startswithR
(toutput_linetpf((s"/sys/lib/python/mercurial/posix.pytparse_patch_output0s
-cCs:|od||fp|}|od||fp|S(sBuild argument list for sshs%s@%ss%s -p %s((tsshcmdthosttusertporttargs((s"/sys/lib/python/mercurial/posix.pytsshargs;scCsti|�id@djS(s"check whether a file is executablei@i(Rtlstattst_mode(R((s"/sys/lib/python/mercurial/posix.pytis_exec@scCsBti|�i}|ooti|�pWt|�i�}ti|�yti||�Wq�t|d�i	|�q�XndSnti|�oAti
|�}ti|�t|d�i	|�dt@}n|d@}|o-|o%ti|||d@d?t@B�n(|o|oti||d@�ndS(Ntwi�i@i$i(
RR)R*tstattS_ISLNKtopentreadtunlinktsymlinktwritetreadlinktumasktchmod(Rtltxtstdatatsx((s"/sys/lib/python/mercurial/posix.pyt	set_flagsDs(


%cCsdS(N((tfd((s"/sys/lib/python/mercurial/posix.pyt
set_binarybscCs|S(N((R((s"/sys/lib/python/mercurial/posix.pytpconvertescCs|S(N((R((s"/sys/lib/python/mercurial/posix.pyt	localpathhstdarwincCs�d}d}yti||�}Wn3tj
o'}|itijo|Sn�nXz$ti||dd�id�SWdti|�XdS(sL
        Returns the true, canonical file system path equivalent to the given
        path.

        Equivalent means, in this case, resulting in the same, unique
        file system link to the path. Every file system entry, whether a file,
        directory, hard link or symbolic link or special, will have a single
        path preferred by the system, but may allow multiple, differing path
        lookups to point to it.

        Most regular UNIX file systems only allow a file system entry to be
        looked up by its distinct path. Obviously, this does not apply to case
        insensitive file systems, whether case preserving or not. The most
        complex issue to deal with is file systems transparently reencoding the
        path, such as the non-standard Unicode normalisation required for HFS+
        and HFSX.
        i2i tiN(RR/RterrnotENOENTtfcntltrstriptclose(Rt	F_GETPATHt	O_SYMLINKR=terr((s"/sys/lib/python/mercurial/posix.pytrealpathls$cCs7tiidjod|Snd|idd�SdS(NRs"%s"s'%s'Rs'\''(RRRtreplace(R9((s"/sys/lib/python/mercurial/posix.pyt
shellquote�scCs|S(N((tcmd((s"/sys/lib/python/mercurial/posix.pytquotecommand�strcCsti||�S(N(Rtpopen(tcommandtmode((s"/sys/lib/python/mercurial/posix.pyRQ�scCs_tiidjotSnyti|d�tSWn%tj
o}|itijSnXdS(s5return False if pid dead, True if running or not sureRiN(RRRRtkillRRCtESRCH(tpidtinst((s"/sys/lib/python/mercurial/posix.pyttestpid�scCs�ti|�o'ti|�}td�||fSnoti|�o'ti|�}td�||fSn8ti|�o'ti|�}td�||fSnttd���dS(s;return a 2-tuple (desc, code) describing a process's statussexited with status %dskilled by signal %dsstopped by signal %dsinvalid exit codeN(	Rt	WIFEXITEDtWEXITSTATUSRtWIFSIGNALEDtWTERMSIGt
WIFSTOPPEDtWSTOPSIGt
ValueError(tcodetval((s"/sys/lib/python/mercurial/posix.pytexplain_exit�scCs|iti�jS(s;Return True if the stat object st is from the current user.(tst_uidRtgetuid(tst((s"/sys/lib/python/mercurial/posix.pytisowner�scCs�tidjo|Snd�}ti|jo||�SnxYtiidd�iti�D]6}|tii	||��}|dj	o|SqaqaWdS(s�Find executable for command searching like which does.
    If command is a basename then PATH is searched for command.
    PATH isn't searched if command is an absolute or relative path.
    If command isn't found None is returned.RcSstii|�o|SndS(s'Will return executable if existing fileN(RRtexiststNone(t
executable((s"/sys/lib/python/mercurial/posix.pytfindexisting�stPATHtN(RRRtseptenvirontgettsplittpathsepRRRh(RRRjRRi((s"/sys/lib/python/mercurial/posix.pytfind_exe�s	"
cCsdS(N((((s"/sys/lib/python/mercurial/posix.pytset_signal_handler�sccstti}xd|D]\}y||�}Wn>tj
o2}|ititifjo�nd}nX|VqWdS(sFStat each file in files and yield stat or None if file does not exist.N(RR)RRCRDtENOTDIRRh(tfilesR)tnfReRJ((s"/sys/lib/python/mercurial/posix.pyt	statfiles�s	cCs
ti�S(sreturn name of current user(tgetpasstgetuser(((s"/sys/lib/python/mercurial/posix.pyRy�scCs
t|�S(s;On Windows, expand the implicit globs in a list of patterns(tlist(tpats((s"/sys/lib/python/mercurial/posix.pytexpand_glob�scCsV|djoti�}nyti|�dSWntj
ot|�SnXdS(siReturn the name of the user with the given uid.

    If uid is None, return the name of the current user.iN(RhRRdtpwdtgetpwuidtKeyErrortstr(tuid((s"/sys/lib/python/mercurial/posix.pytusername�s
cCsV|djoti�}nyti|�dSWntj
ot|�SnXdS(skReturn the name of the group with the given gid.

    If gid is None, return the name of the current group.iN(RhRtgetgidtgrptgetgrgidRR�(tgid((s"/sys/lib/python/mercurial/posix.pyt	groupname�s
(/ti18nRRRRRCR-RxR}R�RER/t	posixfiletnulldevRtnormpathtsamestattFalsetexpandglobsR5RRRRR"R(R+R<R>R?R@RRKRMRORQRXRbRfRrRsRwRyR|RhR�R�(((s"/sys/lib/python/mercurial/posix.pys<module>sH`
												
#			
	
						

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].