3

Q'ícWã@sždZddlZddlZddlZddlmZdddgZddd„Zdd	d„Zd
d„Z	dd
„Z
dd„Zdd„Zdd„Z
ejdƒZejdƒZdd„Zdd„Zdd„ZdS)zÊ
Filename globbing utility. Mostly a copy of `glob` from Python 3.5.

Changes include:
 * `yield from` and PEP3102 `*` removed.
 * `bytes` changed to `six.binary_type`.
 * Hidden files are not ignored.
éN)Úbinary_typeÚglobÚiglobÚescapeFcCstt||dƒS)ayReturn 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	ú5/tmp/pip-build-l_bcah40/setuptools/setuptools/glob.pyrscCs,t||ƒ}|r(t|ƒr(t|ƒ}|s(t‚|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Ú_isrecursiveÚnextÚAssertionError)rrÚitÚsr	r	r
r s


ccstjj|ƒ\}}t|ƒsF|r0tjj|ƒrB|Vntjj|ƒrB|VdS|s|rrt|ƒrrx4t||ƒD]
}|VqbWnxt||ƒD]
}|Vq~WdS||kr¬t|ƒr¬t	||ƒ}n|g}t|ƒrÒ|rÌt|ƒrÌt}qÖt}nt
}x0|D](}x"|||ƒD]}tjj||ƒVqìWqÜWdS)N)ÚosÚpathÚsplitÚ	has_magicÚlexistsÚisdirrÚglob2Úglob1rÚglob0Újoin)rrÚdirnameÚbasenameÚxÚdirsÚglob_in_dirÚnamer	r	r
r2s4

rcCsR|s"t|tƒrtjjdƒ}ntj}ytj|ƒ}Wntk
rDgSXtj||ƒS)NÚASCII)	Ú
isinstancerrÚcurdirÚencodeÚlistdirÚOSErrorÚfnmatchÚfilter)rÚpatternÚnamesr	r	r
r]s
rcCs8|stjj|ƒr4|gSntjjtjj||ƒƒr4|gSgS)N)rrrrr)rrr	r	r
rjsrccs6t|ƒst‚|dd…Vxt|ƒD]
}|Vq$WdS)Nr)rrÚ	_rlistdir)rr)rr	r	r
rzsrc
cs˜|s"t|tƒrttjdƒ}ntj}ytj|ƒ}Wntjk
rFdSXxJ|D]B}|V|rjtjj||ƒn|}x t|ƒD]}tjj||ƒVqxWqNWdS)Nr!)	r"rrr#r%Úerrorrrr+)rr*rrÚyr	r	r
r+‚s

r+z([*?[])s([*?[])cCs(t|tƒrtj|ƒ}n
tj|ƒ}|dk	S)N)r"rÚmagic_check_bytesÚsearchÚmagic_check)rÚmatchr	r	r
r—s

rcCst|tƒr|dkS|dkSdS)Ns**z**)r"r)r)r	r	r
rŸs
rcCs<tjj|ƒ\}}t|tƒr(tjd|ƒ}ntjd|ƒ}||S)z#Escape all special characters.
    s[\1]z[\1])rrÚ
splitdriver"rr.Úsubr0)rÚdriver	r	r
r¦s

)F)F)Ú__doc__rÚrer'Zsetuptools.extern.sixrÚ__all__rrrrrrr+Úcompiler0r.rrrr	r	r	r
Ú<module>s"


+