File: //usr/local/CyberCP/lib/python3.10/site-packages/docker/utils/__pycache__/build.cpython-310.pyc
o
�hJ � @ s� d dl Z d dlZd dlZd dlZd dlZddlmZ ddlmZ er'e�d�ne�d�Z e�d�Z
d ed
efdd�Z
d#dd�Zd$dd�Zdd� Z
d%dd�Zdd� Zdd� Zdd� Zd&dd�ZG dd � d �ZG d!d"� d"�ZdS )'� N� )�IS_WINDOWS_PLATFORM� )�fnmatchz/|\\�/zy^[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*(?::[0-9]+)?(/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)*(:[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127})?$�tag�returnc C s t t�| ��S �N)�bool�_TAG�match)r � r
�E/usr/local/CyberCP/lib/python3.10/site-packages/docker/utils/build.py� match_tag s r Fc C sv t j�| �}|p g }|p
d}g }|d d ur)d�|pdg|d g �}d|f|g}ttt|||d d��||||d�S )N)NNr �
z
.dockerignorer )�
dockerfile)�files�root�fileobj�gzip�extra_files)�os�path�abspath�join�create_archive�sorted�
exclude_paths)r �excluder r r r r �dockerignore_contentsr
r
r �tar s ���r c C s2 |du rd}|� d|� �� t|�}t|�| ��S )a
Given a root directory path and a list of .dockerignore patterns, return
an iterator of all paths (both regular files and directories) in the root
directory that do *not* match any of the patterns.
All paths returned are relative to the root.
N�
Dockerfile�!)�append�PatternMatcher�set�walk)r �patternsr �pmr
r
r r ) s
r c C sT g }t �| �D ] \}}}|| D ]}t j�||�}|�|�| dd��d�� qq|S )N� r r )r r&