HEX
Server: Apache
System: Linux eisbus 6.8.12-9-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-9 (2025-03-16T19:18Z) x86_64
User: www-data (33)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //proc/863910/root/usr/lib/tklbam/utils.pyc
�
+��dc@s�ddlZddlTddlZddlZddlZddlZddlmZd�Zdefd��YZ	d�Z
d�Zd	�Zd
d�Z
d�Zd
�Zd�ZdS(i����N(t*(tStringIOcCsJt|�stSt|�r9t|�r9tj|�n
tj|�tS(smRemove a path whether it is a file or a directory.
       Return: True if removed, False if nothing to remove(	tlexiststFalsetislinktisdirtshutiltrmtreetostremovetTrue(tpath((s/usr/lib/tklbam/utils.pyt
remove_anys
tAttrDictcBseZd�Zd�ZRS(cCs(||kr||Std|��dS(Nsno such attribute '%s'(tAttributeError(tselftname((s/usr/lib/tklbam/utils.pyt__getattr__$scCs|||<dS(N((RRtval((s/usr/lib/tklbam/utils.pyt__setattr__)s(t__name__t
__module__RR(((s/usr/lib/tklbam/utils.pyR
#s	cCs.yt|d�tSWntk
r)tSXdS(Nsw+(tfileR
tIOErrorR(tfpath((s/usr/lib/tklbam/utils.pytis_writeable,s


cCs�tj|�}tj|j�}tjj|�rctjj|tjjtjj	|���}n|r�tj
|�}tj||�tj|�n)t
j||�tj||j|j�dS(N(RtlstattstattS_ISLNKtst_modeRRtjointbasenametabspathtreadlinktsymlinktunlinkRtmovetlchowntst_uidtst_gid(tsrctdsttstt
is_symlinktlinkto((s/usr/lib/tklbam/utils.pyR$4s0cCsJtj�}tj|�tjd|tj|�f�tj|�dS(Ns;tar --create --files-from=%s | tar --extract --directory %s(Rtgetcwdtchdirtexecutilt	getoutputtmkarg(R(R)t
olist_pathtorig_cwd((s/usr/lib/tklbam/utils.pyt
apply_overlayDs

	t=cCs|d|t|�dS(Ns
(tlen(ttitletc((s/usr/lib/tklbam/utils.pyt	fmt_titleLscCs^t�}dtjj�j�}|dt|�IJ||IJ|dt|�IJ|j�S(Ns
### %s ###t#(RtdatetimetnowtctimeR6tgetvalue(tfhts((s/usr/lib/tklbam/utils.pyt
fmt_timestampOs	
cCs)tjtjj|�tj�r%|S|S(s<Return global path if writeable, otherwise return local path(RtaccessRtdirnametW_OK(tpath_globalt
path_local((s/usr/lib/tklbam/utils.pytpath_global_or_localZs!cCstj�dkS(Ni(Rtgetuid(((s/usr/lib/tklbam/utils.pytiamrootas(Rtos.pathR/RRR;RRtdictR
RR$R4R9RARGRI(((s/usr/lib/tklbam/utils.pyt<module>s