File: //proc/863910/root/usr/lib/tklbam/utils.pyc
�
+��dc @ s� d d l Z d d l Td d l Z d d l Z d d l Z d d l Z d d l m Z d � Z d e f d � � YZ d � Z
d � Z d � Z d
d � Z
d � Z d
� Z d � Z d S( i����N( t *( t StringIOc C sJ t | � s t St | � r9 t | � r9 t j | � n
t j | � t S( sm Remove a path whether it is a file or a directory.
Return: True if removed, False if nothing to remove( t lexistst Falset islinkt isdirt shutilt rmtreet ost removet True( t path( ( s /usr/lib/tklbam/utils.pyt
remove_any s
t AttrDictc B s e Z d � Z d � Z RS( c C s( | | k r | | St d | � � d S( Ns no such attribute '%s'( t AttributeError( t selft name( ( s /usr/lib/tklbam/utils.pyt __getattr__$ s c C s | | | <d S( N( ( R R t val( ( s /usr/lib/tklbam/utils.pyt __setattr__) s ( t __name__t
__module__R R ( ( ( s /usr/lib/tklbam/utils.pyR
# s c C s. y t | d � t SWn t k
r) t SXd S( Ns w+( t fileR
t IOErrorR ( t fpath( ( s /usr/lib/tklbam/utils.pyt is_writeable, s
c C s� t j | � } t j | j � } t j j | � rc t j j | t j j t j j | � � � } n | r� t j
| � } t j | | � t j | � n) t
j | | � t j | | j | j � d S( N( R t lstatt statt S_ISLNKt st_modeR R t joint basenamet abspatht readlinkt symlinkt unlinkR t movet lchownt st_uidt st_gid( t srct dstt stt
is_symlinkt linkto( ( s /usr/lib/tklbam/utils.pyR$ 4 s 0c C sJ t j � } t j | � t j d | t j | � f � t j | � d S( Ns; tar --create --files-from=%s | tar --extract --directory %s( R t getcwdt chdirt executilt getoutputt mkarg( R( R) t
olist_patht orig_cwd( ( s /usr/lib/tklbam/utils.pyt
apply_overlayD s
t =c C s | d | t | � d S( Ns
( t len( t titlet c( ( s /usr/lib/tklbam/utils.pyt fmt_titleL s c C s^ t � } d t j j � j � } | d t | � IJ| | IJ| d t | � IJ| j � S( Ns
### %s ###t #( R t datetimet nowt ctimeR6 t getvalue( t fht s( ( s /usr/lib/tklbam/utils.pyt
fmt_timestampO s
c C s) t j t j j | � t j � r% | S| S( s<