%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/wheel/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/wheel/file_roots.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Z
dd�Zdd�Zd�Z
dd	�Zddd
�ZdS(uB
Read in files from the file_root and save files to the file root
i(tabsolute_importtprint_functiontunicode_literalsN(tsixubasec	C@s�g}|tdkr|Sx�td|D]�}tjj||�}tjjj||�sbq)ntjj|�r)tjj	j
|d��G}tjj	j|�r�|jid|6�n|jid|6�WdQXq)q)W|S(uP
    Return a dict of the files located with the given path and environment
    u
file_rootsurbutxtubinN(
t__opts__tostpathtjointsalttutilstverifyt
clean_pathtisfiletfilestfopentis_texttappend(Rtsaltenvtrettroottfulltfp_((s9/usr/lib/python2.7/site-packages/salt/wheel/file_roots.pytfinds!c
C@s9i}|tdkr|Sxtd|D]}i||<x�tjjj|�D]�\}}}||}||kr�|}g}xVtjj||�s�tjj|�}	|	r�|jd|	�ntjj	|�}q�Wx|D]}
||
}q�Wnx|D]}i||<q�Wx|D]}d||<qWqOWq)W|S(u>
    Return all of the file paths found in an environment
    u
file_rootsiuf(
RRR	Rtos_walkRtsamefiletbasenametinserttdirname(
RRtf_rootRtdirsR
tsubtsroottabovetbasetaroottdir_tfn_((s9/usr/lib/python2.7/site-packages/salt/wheel/file_roots.pytlist_env(s,
%



cC@s@i}x3tdD]'}g||<||jt|��qW|S(uE
    Return all of the files names in all available environments
    u
file_roots(RRR%(RR((s9/usr/lib/python2.7/site-packages/salt/wheel/file_roots.pyt
list_rootsFs

c	C@s�g}t||�}x�|D]~}ttj|��}||}|dkrtjjj|d��0}|jitjj	j
|j��|6�WdQXqqW|S(uF
    Read the contents of a text file, if the file is binary then
    utxturbN(RtnextRtiterkeysRR	R
RRtstringutilst
to_unicodetread(RRRR
R$RtformR((s9/usr/lib/python2.7/site-packages/salt/wheel/file_roots.pyR+Qs

0cC@s9|tdkrdj|�Sttd|�|krGdj||�Stjj|�ridj||�Std||}tjj||�}tjj	j
||dt�s�dj|�Stjj|�}tjj
|�s�tj|�ntjjj|d��#}|jtjjj|��WdQXd	j|�S(
u�
    Write the named file, by default the first file found is written, but the
    index of the file can be specified to write to a lower priority file root
    u
file_rootsu$Named environment {0} is not presentu5Specified index {0} in environment {1} is not presentu=The path passed in {0} is not relative to the environment {1}tsubdiruInvalid path: {}uw+NuWrote data to file {0}(RtformattlenRRtisabsRRR	R
RtTrueRtisdirtmakedirsR
RtwriteR)tto_str(tdataRRtindexRtdesttdest_dirR((s9/usr/lib/python2.7/site-packages/salt/wheel/file_roots.pyR4cs$



"(t__doc__t
__future__RRRRtsalt.utils.filesRtsalt.utils.pathtsalt.extRRR%R&R+R4(((s9/usr/lib/python2.7/site-packages/salt/wheel/file_roots.pyt<module>s	

Zerion Mini Shell 1.0