File: //usr/lib/python3/dist-packages/S3/__pycache__/FileLists.cpython-310.pyc
o
�Qaf � @ s( d dl mZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZmZ ddl m
Z
mZmZm
Z
dd lmZ dd
lmZ d dlmZmZmZ d dlZd dlZd dlZd dlZd dlZd dlZejd
kZg d�Zdd� Zdd� Zdd� Z dd� Z!dd� Z"dd� Z#d"dd�Z$ddi fdd�Z%d d!� Z&dS )#� )�absolute_import� )�S3)�Config)�S3Uri)�FileDict)�dateS3toUnix�dateRFC822toUnix)� unicodise�deunicodise�
deunicodise_s�replace_nonprintables)�ParameterError)� HashCache)�debug�info�warningN)� r )�fetch_local_list�fetch_remote_list�compare_filelistsc c s� � z t �t| ��}W n
ty Y dS w g g }}|D ]#}t|�}t j�tt j�| |���r:t| |�s9|� |� q|� |� q| ||fV |D ]}t j�| |�}t j�
t|��sct|�D ]}|V q]qHdS )z_
Reimplementation of python's os.walk to nicely support unicode in input as in output.
N)�os�listdirr � Exceptionr
�path�isdir�join�handle_exclude_include_walk_dir�append�islink�_os_walk_unicode)�top�names�dirs�nondirs�name�new_path�x� r( �./usr/lib/python3/dist-packages/S3/FileLists.pyr ! s, ��
���r c C s� t � }tj�| |d�}td| � d}|jD ]!}|j�d�s%|j�d�s%q|�|�r7d}td|j | � nq|rh|j
D ]*}|j�d�sL|j�d�sLq=td||jf � |�|�rgd}td |j| � nq=|rrtd
| � |S td| � |S )a
Should this root/dirname directory be excluded? (otherwise included by default)
Exclude dir matches in the current directory
This prevents us from recursing down trees we know we want to ignore
return True for including, and False for excluding
� z CHECK: %rFz\/$z \/\Z(?ms)T�EXCL-MATCH: '%s'zINCL-TEST: %s ~ %s�INCL-MATCH: '%s'zEXCLUDE: %r�PASS: %r)r r r r r �exclude�pattern�endswith�search�
debug_exclude�include�
debug_include)�root�dirname�cfg�d�excluded�rr( r( r) r : s2
�
��r c
c s� � t j�t| ��sJ �t| g�}t| �D ]F\}}}tt j�t|���}|D ]4}t j�||�}tt j�t|���}t j� t|��rY||ksM|�
|t jj �rTtd| � q%|�
|� q%q|D ]} t| �D ]\}}}|||fV qcq]dS )z�
Walk filesystem, following symbolic links (but without recursion), on python2.4 and later
If a symlink directory loop is detected, emit a warning and skip.
E.g.: dir1/dir2/sym-dir -> ../dir2
z+Skipping recursively symlinked directory %sN)r r r r �setr r
�realpathr r �
startswith�sepr �add)
r �walkdirs�dirpath�dirnames� filenames�real_dirpathr6 �current�real_current�walkdirr( r( r) �_fswalk_follow_symlinks] s* �
�
�� ��rH c c s&