ó
%}Xc           @   sË   d  Z  d d l Z d d l Z d d l Z d d l m Z d d d g Z e d  Z e d  Z	 d	   Z
 d
   Z d   Z d   Z d   Z e j d  Z e j d  Z d   Z d   Z d   Z d S(   sÊ   
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.
i˙˙˙˙N(   t   binary_typet   globt   iglobt   escapec         C   s   t  t |  d |  S(   sy  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.
    t	   recursive(   t   listR   (   t   pathnameR   (    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR      s    c         C   sA   t  |  |  } | r= t |   r= t |  } | s= t  n  | S(   s  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.
    (   t   _iglobt   _isrecursivet   nextt   AssertionError(   R   R   t   itt   s(    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR       s
    c         c   sn  t  j j |   \ } } t |   se | rG t  j j |   ra |  Vqa n t  j j |  ra |  Vn  d  S| sÂ | r t |  r x> t | |  D] } | Vq Wn x t | |  D] } | VqŻ Wd  S| |  k rì t |  rì t	 | |  } n	 | g } t |  r%| rt |  rt } q+t } n t
 } x< | D]4 } x+ | | |  D] } t  j j | |  VqHWq2Wd  S(   N(   t   ost   patht   splitt	   has_magict   lexistst   isdirR   t   glob2t   glob1R   t   glob0t   join(   R   R   t   dirnamet   basenamet   xt   dirst   glob_in_dirt   name(    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR   2   s4    				c         C   sn   |  s6 t  | t  r* t j j d  }  q6 t j }  n  y t j |   } Wn t k
 r] g  SXt j | |  S(   Nt   ASCII(	   t
   isinstanceR    R   t   curdirt   encodet   listdirt   OSErrort   fnmatcht   filter(   R   t   patternt   names(    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR   ]   s    c         C   sN   | s" t  j j |   rJ | g Sn( t  j j t  j j |  |   rJ | g Sg  S(   N(   R   R   R   R   R   (   R   R   (    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR   j   s    
!c         c   s;   t  |  s t  | d  Vx t |   D] } | Vq( Wd  S(   Ni    (   R   R
   t	   _rlistdir(   R   R%   R   (    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR   z   s    	c         c   sÇ   |  s6 t  |  t  r* t t j d  }  q6 t j }  n  y t j |   } Wn t j k
 r` d  SXx_ | D]W } | V|  r t j j |  |  n | } x( t |  D] } t j j | |  VqĦ Wqh Wd  S(   NR   (	   R   R    R   R   R!   t   errorR   R   R'   (   R   R&   R   R   t   y(    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR'      s    !s   ([*?[])c         C   s:   t  |  t  r! t j |   } n t j |   } | d  k	 S(   N(   R   R    t   magic_check_bytest   searcht   magic_checkt   None(   R   t   match(    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR      s    c         C   s'   t  |  t  r |  d k S|  d k Sd  S(   Ns   **(   R   R    (   R%   (    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR      s    
c         C   sV   t  j j |   \ } }  t |  t  r< t j d |   }  n t j d |   }  | |  S(   s#   Escape all special characters.
    s   [\1](   R   R   t
   splitdriveR   R    R*   t   subR,   (   R   t   drive(    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyR   Ĥ   s
    (   t   __doc__R   t   reR#   t   setuptools.extern.sixR    t   __all__t   FalseR   R   R   R   R   R   R'   t   compileR,   R*   R   R   R   (    (    (    s3   /usr/lib/python2.7/dist-packages/setuptools/glob.pyt   <module>   s"   	+						