Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.21.125.193
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : manifest.cpython-36.pyc
3

���e�9�@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZdgZej
e�Zejdej�Zejd	ejejB�Zejdd
�ZGdd�de�ZdS)zu
Class representing the list of files in a distribution.

Equivalent to distutils.filelist, but fixes some problems.
�N�)�DistlibException)�fsdecode)�convert_path�Manifestz\\w*
z#.*?(?=
)|
(?=$)�c@szeZdZdZddd�Zdd�Zdd�Zd	d
�Zddd
�Zdd�Z	dd�Z
dd�Zddd�Zd dd�Z
d!dd�Zdd�ZdS)"rz~A list of files built by on exploring the filesystem and filtered by
    applying various patterns to what we find there.
    NcCs>tjjtjj|ptj���|_|jtj|_d|_t	�|_
dS)zd
        Initialise an instance.

        :param base: The base directory to explore under.
        N)�os�path�abspath�normpath�getcwd�base�sep�prefix�allfiles�set�files)�selfr
�r�/usr/lib/python3.6/manifest.py�__init__*szManifest.__init__cCs�ddlm}m}m}g|_}|j}|g}|j}|j}xv|r�|�}tj	|�}	x\|	D]T}
tj
j||
�}tj|�}|j}
||
�r�|jt
|��qR||
�rR||
�rR||�qRWq8WdS)zmFind all files under the base and set ``allfiles`` to the absolute
        pathnames of files found.
        r)�S_ISREG�S_ISDIR�S_ISLNKN)�statrrrrr
�pop�appendr�listdirr	�join�st_moder)rrrrr�root�stackr�push�names�name�fullnamer�moderrr�findall9s"



zManifest.findallcCs4|j|j�stjj|j|�}|jjtjj|��dS)zz
        Add a file to the manifest.

        :param item: The pathname to add. This can be relative to the base.
        N)	�
startswithrrr	rr
r�addr)r�itemrrrr)TszManifest.addcCsx|D]}|j|�qWdS)z�
        Add a list of files to the manifest.

        :param items: The pathnames to add. These can be relative to the base.
        N)r))r�itemsr*rrr�add_many^s
zManifest.add_manyFcsf��fdd��t�j�}|rJt�}x|D]}�|tjj|��q(W||O}dd�tdd�|D��D�S)z8
        Return sorted files in directory order
        csJ|j|�tjd|�|�jkrFtjj|�\}}|dks<t��||�dS)Nzadd_dir added %s��/)r-r.)r)�logger�debugr
rr	�split�AssertionError)�dirs�d�parent�_)�add_dirrrrr7ls

z Manifest.sorted.<locals>.add_dircSsg|]}tjj|��qSr)rr	r)�.0Z
path_tuplerrr�
<listcomp>zsz#Manifest.sorted.<locals>.<listcomp>css|]}tjj|�VqdS)N)rr	r1)r8r	rrr�	<genexpr>{sz"Manifest.sorted.<locals>.<genexpr>)rrrr	�dirname�sorted)rZwantdirs�resultr3�fr)r7rrr<gs

zManifest.sortedcCst�|_g|_dS)zClear all collected files.N)rrr)rrrr�clear}szManifest.clearcCs�|j|�\}}}}|dkrFx&|D]}|j|dd�s tjd|�q W�n<|dkrnx|D]}|j|dd�}qTW�n|dkr�x&|D]}|j|dd�s|tjd|�q|Wn�|d	kr�x�|D]}|j|dd�}q�Wn�|d
k�r�x�|D] }|j||d�s�tjd||�q�Wn�|d
k�r&xz|D]}|j||d�}�qWn\|dk�rN|jd|d��s�tjd|�n4|dk�rv|jd|d��s�tjd|�ntd|��dS)av
        Process a directive which either adds some files from ``allfiles`` to
        ``files``, or removes some files from ``files``.

        :param directive: The directive to process. This should be in a format
                     compatible with distutils ``MANIFEST.in`` files:

                     http://docs.python.org/distutils/sourcedist.html#commands
        �includeT)�anchorzno files found matching %r�excludezglobal-includeFz3no files found matching %r anywhere in distributionzglobal-excludezrecursive-include)rz-no files found matching %r under directory %rzrecursive-exclude�graftNz no directories found matching %r�prunez4no previously-included directories found matching %rzinvalid action %r)�_parse_directive�_include_patternr/Zwarning�_exclude_patternr)r�	directive�action�patterns�thedirZ
dirpattern�pattern�foundrrr�process_directive�sD









zManifest.process_directivec	Cs|j�}t|�dkr,|ddkr,|jdd�|d}d}}}|dkrxt|�dkr`td
|��dd�|dd�D�}n�|dkr�t|�dkr�td|��t|d�}dd�|dd�D�}n<|dk�r�t|�dkr�td|��t|d�}ntd|��||||fS)z�
        Validate a directive.
        :param directive: The directive to validate.
        :return: A tuple of action, patterns, thedir, dir_patterns
        rrr@rB�global-include�global-exclude�recursive-include�recursive-excluderCrDNrz$%r expects <pattern1> <pattern2> ...cSsg|]}t|��qSr)r)r8�wordrrrr9�sz-Manifest._parse_directive.<locals>.<listcomp>�z*%r expects <dir> <pattern1> <pattern2> ...cSsg|]}t|��qSr)r)r8rSrrrr9�sz!%r expects a single <dir_pattern>zunknown action %r)r@rBrOrPrQrRrCrD)r@rBrOrP)rQrR)rCrD)r1�len�insertrr)rrHZwordsrIrJrKZdir_patternrrrrE�s:



zManifest._parse_directiveTcCsTd}|j||||�}|jdkr&|j�x(|jD]}|j|�r.|jj|�d}q.W|S)a�Select strings (presumably filenames) from 'self.files' that
        match 'pattern', a Unix-style wildcard (glob) pattern.

        Patterns are not quite the same as implemented by the 'fnmatch'
        module: '*' and '?'  match non-special characters, where "special"
        is platform-dependent: slash on Unix; colon, slash, and backslash on
        DOS/Windows; and colon on Mac OS.

        If 'anchor' is true (the default), then the pattern match is more
        stringent: "*.py" will match "foo.py" but not "foo/bar.py".  If
        'anchor' is false, both of these will match.

        If 'prefix' is supplied, then only filenames starting with 'prefix'
        (itself a pattern) and ending with 'pattern', with anything in between
        them, will match.  'anchor' is ignored in this case.

        If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and
        'pattern' is assumed to be either a string containing a regex or a
        regex object -- no translation is done, the regex is just compiled
        and used as-is.

        Selected strings will be added to self.files.

        Return True if files are found.
        FNT)�_translate_patternrr'�searchrr))rrLrAr�is_regexrM�
pattern_rer$rrrrFs

zManifest._include_patterncCsFd}|j||||�}x,t|j�D]}|j|�r |jj|�d}q W|S)atRemove strings (presumably filenames) from 'files' that match
        'pattern'.

        Other parameters are the same as for 'include_pattern()', above.
        The list 'self.files' is modified in place. Return True if files are
        found.

        This API is public to allow e.g. exclusion of SCM subdirs, e.g. when
        packaging source distributions
        FT)rW�listrrX�remove)rrLrArrYrMrZr>rrrrG)s
zManifest._exclude_patternc
Cs�|rt|t�rtj|�S|Stdkr:|jd�jd�\}}}|rj|j|�}td
krn|j|�rd|j|�snt	�nd}tj
tjj
|jd��}	|dk	�rftdkr�|jd�}
|j|�dt|
��}n>|j|�}|j|�r�|j|�s�t	�|t|�t|�t|��}tj}tjdk�rd}tdk�r4d|	|j
|d	|f�}n0|t|�t|�t|��}d
||	||||f}n8|�r�tdk�r�d|	|}nd||	|t|�d�f}tj|�S)aTranslate a shell-like wildcard pattern to a compiled regular
        expression.

        Return the compiled regex.  If 'is_regex' true,
        then 'pattern' is directly compiled to a regex (if it's a string)
        or just returned as-is (assumes it's a regex object).
        rTrr6r-N�\z\\�^z.*z%s%s%s%s.*%s%sz%s%s%s)rTr)rTr)rTr)rTr)rTr)�
isinstance�str�re�compile�_PYTHON_VERSION�_glob_to_re�	partitionr(�endswithr2�escaperr	rr
rUr)
rrLrArrY�startr6�endrZr
Z
empty_patternZ	prefix_rerrrrrW=sB	








zManifest._translate_patterncCs8tj|�}tj}tjdkrd}d|}tjd||�}|S)z�Translate a shell-like glob pattern to a regular expression.

        Return a string containing the regex.  Differs from
        'fnmatch.translate()' in that '*' does not match "special characters"
        (which are platform-specific).
        r]z\\\\z\1[^%s]z((?<!\\)(\\\\)*)\.)�fnmatch�	translaterrra�sub)rrLrZrZescapedrrrrdts

zManifest._glob_to_re)N)F)TNF)TNF)TNF)�__name__�
__module__�__qualname__�__doc__rr'r)r,r<r?rNrErFrGrWrdrrrrr%s 

	
O/
(

6)rprjZloggingrra�sysr-r�compatr�utilr�__all__Z	getLoggerrmr/rb�MZ_COLLAPSE_PATTERN�SZ_COMMENTED_LINE�version_inforc�objectrrrrr�<module>
s

© 2025 GrazzMean