a
lj9 @ s d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl
mZ dgZe
eZedejZed ejejB Zejdd
ZG dd deZdS )zu
Class representing the list of files in a distribution.
Equivalent to distutils.filelist, but fixes some problems.
N )DistlibException)fsdecodeconvert_pathManifestz\\w*
z#.*?(?=
)|
(?=$) c @ sz e Zd ZdZdddZdd Zdd Zd d
Zddd
Zdd Z dd Z
dd ZdddZd ddZ
d!ddZdd ZdS )"r z~A list of files built by on exploring the filesystem and filtered by
applying various patterns to what we find there.
Nc C s> t jt j|pt | _| jt j | _d| _t | _
dS )zd
Initialise an instance.
:param base: The base directory to explore under.
N)ospathabspathnormpathgetcwdbasesepprefixallfilessetfiles)selfr r @/usr/lib/python3.9/site-packages/pip/_vendor/distlib/manifest.py__init__* s zManifest.__init__c C s ddl m}m}m} g | _}| j}|g}|j}|j}|r| }t |} | D ]R}
tj
||
}t |}|j}
||
r|t
| qN||
rN||
sN|| qNq6dS )zmFind all files under the base and set ``allfiles`` to the absolute
pathnames of files found.
r )S_ISREGS_ISDIRS_ISLNKN)statr r r r r popappendr listdirr
joinst_moder )r r r r r rootstackr pushnamesnamefullnamer moder r r findall9 s"
zManifest.findallc C s4 | | jstj| j|}| jtj| dS )zz
Add a file to the manifest.
:param item: The pathname to add. This can be relative to the base.
N)
startswithr r r
r r r addr )r itemr r r r* T s zManifest.addc C s |D ]}| | qdS )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+ r r r add_many^ s zManifest.add_manyFc sb fdd t j}|rFt }|D ]} |tj| q&||O }dd tdd |D D S )z8
Return sorted files in directory order
c sJ | | td| |jkrFtj|\}}|dvs