o
Xai @ s d Z ddlZddlZddlZg dZdddZdddZd d
Zdd Zd
d Z dd Z
dd ZedZ
edZdd Zdd Zdd ZdS )z
Filename globbing utility. Mostly a copy of `glob` from Python 3.5.
Changes include:
* `yield from` and PEP3102 `*` removed.
* Hidden files are not ignored.
N)globiglobescapeFc C s t t| |dS )ay Return a list of paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la
fnmatch. However, unlike fnmatch, filenames starting with a
dot are special cases that are not matched by '*' and '?'
patterns.
If recursive is true, the pattern '**' will match any files and
zero or more directories and subdirectories.
) recursive)listr )pathnamer r /builddir/build/BUILDROOT/alt-python310-setuptools-58.3.0-4.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/setuptools/glob.pyr s r c C s* t | |}|rt| rt|}|rJ |S )a Return an iterator which yields the paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la
fnmatch. However, unlike fnmatch, filenames starting with a
dot are special cases that are not matched by '*' and '?'
patterns.
If recursive is true, the pattern '**' will match any files and
zero or more directories and subdirectories.
)_iglob_isrecursivenext)r r itsr r r r s
r c c s t j| \}}|rt|rtnt}t| s/|r$t j| r"| V d S t j|r-| V d S |s;|||E d H d S || krIt|rIt ||}n|g}t|sRt
}|D ]}|||D ]
}t j||V q[qTd S N)ospathsplitr glob2glob1 has_magiclexistsisdirr
glob0join)r r dirnamebasenameglob_in_dirdirsnamer r r r
0 s0 r
c C sT | st |trtjd} ntj} zt| }W n ty# g Y S w t||S NASCII)
isinstancebytesr curdirencodelistdirOSErrorfnmatchfilter)r patternnamesr r r r T s
r c C s: |s
t j| r|gS g S t jt j| |r|gS g S r )r r r r r )r r r r r r a s r c c s4 t |sJ |d d V t| D ]}|V qd S )Nr )r _rlistdir)r r) xr r r r q s r c c s | st | trtjd} ntj} zt| }W n tjy$ Y d S w |D ]}|V | r5tj| |n|}t |D ]
}tj||V q;q'd S r )
r! r" r r# r$ r% errorr r r+ )r r* r, r yr r r r+ y s"
r+ z([*?[])s ([*?[])c C s. t | trt| }|d uS t| }|d uS r )r! r" magic_check_bytessearchmagic_check)r matchr r r r s
r c C s t | tr | dkS | dkS )Ns **z**)r! r" )r) r r r r s
r c C sB t j| \}} t| trtd| } || S td| } || S )z#Escape all special characters.
s [\1]z[\1])r r
splitdriver! r" r/ subr1 )r driver r r r s
r )F)__doc__r rer' __all__r r r
r r r r+ compiler1 r/ r r r r r r r