/usr/lib/python3.6/site-packages/slip/util/__pycache__
Edit: /usr/lib/python3.6/site-packages/slip/util/__pycache__/files.cpython-36.pyc (4949B)
3
uAc @ s d Z ddlmZ deekr eZdddddgZdd lZdd l Z dd l
Z
dd lZdd lZd
Z
dd Zg fd
dZdd ZdddZdddZdddZdddZd S )z=This module contains helper functions for dealing with files. )absolute_importxrange
issamefilelinkfilecopyfilelinkorcopyfileoverwrite_safelyNi c C s" t j| }t j|}t jj||S )N)osstatpathsamestat)path1path2s1s2 r /usr/lib/python3.6/files.py_issamefile+ s
r c C s0 |dkrt }y
t| |S |k
r* dS X dS )zECheck whether two paths point to the same file (i.e. are hardlinked).TFN) Exceptionr )r
r catch_stat_exceptionsr r r r 2 s
c C s t | |tdrdS tjj|}tjj|}tjj|}d}xpttj D ]b}tj
|tj |d}ytj| | W n2 tk
r } z|j
t
jkrn W Y dd}~X qFX d}P qFW |rtj|| dS )zUHardlink srcpath to dstpath.
Attempt to atomically replace dstpath if it exists.)r NF)prefixdirT)r OSErrorr r abspathdirnamebasenamerangetempfileTMP_MAXmktempextseplinkerrnoEEXISTrename)srcpathdstpathdstdnamedstbnameZ
hardlinkedattempt_dsttmper r r r > s$ Tc
C s8 t | |tdrdS tjj|}tjj|}tjj|}t| d}tj |tjj
|dd}tj| }|rytj|}W n tk
r Y nX tj|j
tj|j d} xP| dkr|jt} y|j| W q |j |j tj|j Y qX qW |j |j tj|j| |r4tj dkr4tj| dS )zCopy srcpath to dstpath.
Abort operation if e.g. not enough space is available. Attempt to
atomically replace dstpath if it exists.)r NrbF)r r delete r )r r r r r r r openr ZNamedTemporaryFiler r
fchmodfilenoS_IMODEst_moderead BLOCKSIZEwritecloseunlinknamer$ selinuxis_selinux_enabled
restorecon)
r% r&