£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>

Re4                 @   s   d  Z  d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l	 m
 Z
 d g Z e j e  Z e j d e j  Z e j d	 e j e j B Z Gd
 d   d e  Z d S)zu
Class representing the list of files in a distribution.

Equivalent to distutils.filelist, but fixes some problems.
    N   )DistlibException)fsdecode)convert_pathManifestz\\w*
z#.*?(?=
)|
(?=$)c               @   s   e  Z d  Z d Z d d d  Z d d   Z d d   Z d	 d
   Z d d d  Z d d   Z	 d d   Z
 d d   Z d d d d d  Z d d d d d  Z d d d d d  Z d d   Z d S)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   sY   t  j j t  j j | p! t  j     |  _ |  j t  j |  _ d |  _ t	   |  _
 d S)zd
        Initialise an instance.

        :param base: The base directory to explore under.
        N)ospathabspathnormpathgetcwdbasesepprefixallfilessetfiles)selfr    r   7/tmp/pip-ztkk0jow-build/pip/_vendor/distlib/manifest.py__init__#   s    -	zManifest.__init__c             C   s   d d l  m } m } m } g  |  _ } |  j } | g } | j } | j } x | r |   } t j	 |  }	 x |	 D]{ }
 t j
 j | |
  } t j  |  } | j } | |  r | j t |   qu | |  ru | |  ru | |  qu qu WqP Wd S)zmFind all files under the base and set ``allfiles`` to the absolute
        pathnames of files found.
        r   )S_ISREGS_ISDIRS_ISLNKN)statr   r   r   r   r   popappendr   listdirr   joinst_moder   )r   r   r   r   r   rootstackr   pushnamesnamefullnamer   moder   r   r   findall2   s"    							zManifest.findallc             C   sM   | j  |  j  s- t j j |  j |  } n  |  j j t j j |   d S)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(   M   s    zManifest.addc             C   s"   x | D] } |  j  |  q Wd S)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_manyW   s    zManifest.add_manyFc                s      f d d     t   j  } | rj t    } x' | D] }   | t j j |   q: W| | O} n  d d   t d d   | D  D S)z8
        Return sorted files in directory order
        c                sj   |  j  |  t j d |  |  j k rf t j j |  \ } } | d k sV t    |  |  n  d  S)Nzadd_dir added %s /)r,   r-   )r(   loggerdebugr   r   r   splitAssertionError)dirsdparent_)add_dirr   r   r   r6   e   s    z Manifest.sorted.<locals>.add_dirc             S   s"   g  |  ] } t  j j |    q Sr   )r   r   r   ).0Z
path_tupler   r   r   
<listcomp>s   s   	 z#Manifest.sorted.<locals>.<listcomp>c             s   s!   |  ] } t  j j |  Vq d  S)N)r   r   r0   )r7   r   r   r   r   	<genexpr>t   s    z"Manifest.sorted.<locals>.<genexpr>)r   r   r   r   dirnamesorted)r   Zwantdirsresultr2   fr   )r6   r   r   r;   `   s    		zManifest.sortedc             C   s   t    |  _ g  |  _ d S)zClear all collected files.N)r   r   r   )r   r   r   r   clearv   s    zManifest.clearc             C   sS  |  j  |  \ } } } } | d k rc x%| D]. } |  j | d d s. t j d |  q. q. Wn| d k r x| D]. } |  j | d d sv t j d |  qv qv Wn| d k r x| D]. } |  j | d d s t j d	 |  q q Wn\| d
 k r;xM| D]. } |  j | d d st j d |  qqWn| d k rx| D]1 } |  j | d | sNt j d | |  qNqNWn | d k rx | D]1 } |  j | d | st j d | |  qqWn~ | d k r|  j d d | sOt j d |  qOnG | d k r?|  j d d | sOt j d |  qOn t d |   d S)av  
        Process a directive which either adds some files from ``allfiles`` to
        ``files``, or removes some files from ``files``.

        :param directive: The directive to process. This should be in a format
                     compatible with distutils ``MANIFEST.in`` files:

                     http://docs.python.org/distutils/sourcedist.html#commands
        includeanchorTzno files found matching %rexcludez.no previously-included files found matching %rzglobal-includeFz3no files found matching %r anywhere in distributionzglobal-excludezGno previously-included files matching %r found anywhere in distributionzrecursive-includer   z-no files found matching %r under directory %rzrecursive-excludezAno previously-included files matching %r found under directory %rgraftNz no directories found matching %rprunez4no previously-included directories found matching %rzinvalid action %r)_parse_directive_include_patternr.   warning_exclude_patternr   )r   	directiveactionpatternsthedirZ
dirpatternpatternr   r   r   process_directive{   sP    							zManifest.process_directivec          	   C   so  | j    } t |  d k rA | d d k rA | j d d  n  | d } d } } } | d k r t |  d k  r t d |   n  d d   | d d  D } n | d k rt |  d k  r t d |   n  t | d  } d d   | d d  D } nT | d k rOt |  d k r<t d |   n  t | d  } n t d |   | | | | f S)z
        Validate a directive.
        :param directive: The directive to validate.
        :return: A tuple of action, patterns, thedir, dir_patterns
        r   r   r?   rA   global-includeglobal-excluderecursive-includerecursive-excluderB   rC   N   z$%r expects <pattern1> <pattern2> ...c             S   s   g  |  ] } t  |   q Sr   )r   )r7   wordr   r   r   r8      s   	 z-Manifest._parse_directive.<locals>.<listcomp>   z*%r expects <dir> <pattern1> <pattern2> ...c             S   s   g  |  ] } t  |   q Sr   )r   )r7   rS   r   r   r   r8      s   	 z!%r expects a single <dir_pattern>zunknown action %r)includeexcluderN   rO   rP   rQ   graftprune)rU   rV   rN   rO   )rP   rQ   )rW   rX   )r0   leninsertr   r   )r   rH   wordsrI   rJ   rK   Zdir_patternr   r   r   rD      s:        	
	  zManifest._parse_directiveTc             C   sz   d } |  j  | | | |  } |  j d k r: |  j   n  x9 |  j D]. } | j |  rD |  j j |  d } qD qD W| S)a  Select strings (presumably filenames) from 'self.files' that
        match 'pattern', a Unix-style wildcard (glob) pattern.

        Patterns are not quite the same as implemented by the 'fnmatch'
        module: '*' and '?'  match non-special characters, where "special"
        is platform-dependent: slash on Unix; colon, slash, and backslash on
        DOS/Windows; and colon on Mac OS.

        If 'anchor' is true (the default), then the pattern match is more
        stringent: "*.py" will match "foo.py" but not "foo/bar.py".  If
        'anchor' is false, both of these will match.

        If 'prefix' is supplied, then only filenames starting with 'prefix'
        (itself a pattern) and ending with 'pattern', with anything in between
        them, will match.  'anchor' is ignored in this case.

        If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and
        'pattern' is assumed to be either a string containing a regex or a
        regex object -- no translation is done, the regex is just compiled
        and used as-is.

        Selected strings will be added to self.files.

        Return True if files are found.
        FNT)_translate_patternr   r&   searchr   r(   )r   rL   r@   r   is_regexfound
pattern_rer#   r   r   r   rE      s    zManifest._include_patternc             C   sd   d } |  j  | | | |  } x? t |  j  D]. } | j |  r. |  j j |  d } q. q. W| S)at  Remove strings (presumably filenames) from 'files' that match
        'pattern'.

        Other parameters are the same as for 'include_pattern()', above.
        The list 'self.files' is modified in place. Return True if files are
        found.

        This API is public to allow e.g. exclusion of SCM subdirs, e.g. when
        packaging source distributions
        FT)r\   listr   r]   remove)r   rL   r@   r   r^   r_   r`   r=   r   r   r   rG     s    zManifest._exclude_patternc       
      C   s  | r) t  | t  r" t j |  S| Sn  | rA |  j |  } n d } t j t j j |  j	 d   } | d k	 r |  j d  } |  j |  d t
 |   } t j }	 t j d k r d }	 n  d | |	 j | d | f  } n | r d | | } n  t j |  S)a  Translate a shell-like wildcard pattern to a compiled regular
        expression.

        Return the compiled regex.  If 'is_regex' true,
        then 'pattern' is directly compiled to a regex (if it's a string)
        or just returned as-is (assumes it's a regex object).
        r,   N\z\\^z.*)
isinstancestrrecompile_glob_to_reescaper   r   r   r   rY   r   )
r   rL   r@   r   r^   r`   r   Zempty_patternZ	prefix_rer   r   r   r   r\   3  s&    	! 		zManifest._translate_patternc             C   sS   t  j |  } t j } t j d k r0 d } n  d | } t j d | |  } | S)zTranslate a shell-like glob pattern to a regular expression.

        Return a string containing the regex.  Differs from
        'fnmatch.translate()' in that '*' does not match "special characters"
        (which are platform-specific).
        rc   z\\\\z\1[^%s]z((?<!\\)(\\\\)*)\.)fnmatch	translater   r   rg   sub)r   rL   r`   r   escapedr   r   r   ri   W  s    		
zManifest._glob_to_re)__name__
__module____qualname____doc__r   r&   r(   r+   r;   r>   rM   rD   rE   rG   r\   ri   r   r   r   r   r      s    
	L/(#)rr   rk   loggingr   rg   r,   r   compatr   utilr   __all__	getLoggerro   r.   rh   MZ_COLLAPSE_PATTERNSZ_COMMENTED_LINEobjectr   r   r   r   r   <module>
   s   	