B
k%
@ 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)fsdecode)convert_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 A/opt/alt/python37/lib/python3.7/site-packages/distlib/manifest.py__init__* s zManifest.__init__c C s ddl m}m}m} g | _}| j}|g}|j}|j}xt|r| }t |} xZ| D ]R}
tj
||
}t |}|j}
||
r|t
| qR||
rR||
sR|| qRW q8W dS )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 x|D ]}| | qW dS )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 sf fdd t j}|rJt }x|D ]} |tj| q(W ||O }dd tdd |D D S )z8
Return sorted files in directory order
c sJ | | td| |jkrFtj|\}}|dks