‡Æ
7Oö9c       sÕ     d  Z    d Z  d k Z d k Z d k Z d k Z  d k Z  d k T d k l Z  d k	 l
 Z
  d k l Z l Z  d f  d „  ƒ  YZ  e i d	 „ Z @d
 „  Z Ud e d d „ Z d S(   ss   distutils.filelist

Provides the FileList class, used for poking about the filesystem
and building lists of files.
s6   $Id: filelist.py,v 1.8 2000/09/26 02:02:51 gward Exp $N(   s   *(   s   glob(   s   convert_path(   s   DistutilsTemplateErrors   DistutilsInternalErrors   FileListc      sÈ    d  Z  # % e e d „ Z 0 d „  Z 3 e i d „ Z 9 d „  Z < d „  Z G d „  Z	 J d „  Z
 M d „  Z X d	 „  Z a d
 „  Z † d „  Z Ö d e d d „ Z d e d d „ Z RS(   sÑ  A list of files built by on exploring the filesystem and filtered by
    applying various patterns to what we find there.

    Instance attributes:
      dir
        directory from which files will be taken -- only used if
        'allfiles' not supplied to constructor
      files
        list of filenames currently being built/filtered/manipulated
      allfiles
        complete list of files under consideration (ie. without any
        filtering applied)
    c    sK   % ) | p |  i |  _  * | p |  i |  _ , t |  _ - g  |  _ d  S(   N(   s   warns   selfs   _FileList__warns   debug_prints   _FileList__debug_prints   Nones   allfiless   files(   s   selfs   warns   debug_prints/   /mit/python/lib/python2.0/distutils/filelist.pys   __init__% s   c    s   0 1 | |  _  d  S(   N(   s   allfiless   self(   s   selfs   allfiless/   /mit/python/lib/python2.0/distutils/filelist.pys   set_allfiles0 s   c    s   3 4 t  | ƒ |  _ d  S(   N(   s   findalls   dirs   selfs   allfiles(   s   selfs   dirs/   /mit/python/lib/python2.0/distutils/filelist.pys   findall3 s   c    s   9 : t  i i d | ƒ d  S(   Ns   warning: %s
(   s   syss   stderrs   writes   msg(   s   selfs   msgs/   /mit/python/lib/python2.0/distutils/filelist.pys   __warn9 s   c    s0   < ? @ d k  l } A | o B | GHn d S(   s~   Print 'msg' to stdout if the global DEBUG (taken from the
        DISTUTILS_DEBUG environment variable) flag is true.
        (   s   DEBUGN(   s   distutils.cores   DEBUGs   msg(   s   selfs   msgs   DEBUGs/   /mit/python/lib/python2.0/distutils/filelist.pys   __debug_print< s   
c    s   G H |  i i | ƒ d  S(   N(   s   selfs   filess   appends   item(   s   selfs   items/   /mit/python/lib/python2.0/distutils/filelist.pys   appendG s   c    s   J K |  i i | ƒ d  S(   N(   s   selfs   filess   extends   items(   s   selfs   itemss/   /mit/python/lib/python2.0/distutils/filelist.pys   extendJ s   c    sv   M O t  t i i |  i ƒ } P | i ƒ  Q g  |  _ R x5 | d R r( } S |  i i	 t
 t i i | ƒ ƒ qC Wd  S(   Ni    (   s   maps   oss   paths   splits   selfs   filess   sortable_filess   sorts
   sort_tuples   appends   applys   join(   s   selfs   sortable_filess
   sort_tuples/   /mit/python/lib/python2.0/distutils/filelist.pys   sortM s    	c    sm   X Z x` t  t |  i ƒ d d d ƒ d Z r9 } [ |  i | |  i | d j o \ |  i | =n q) Wd  S(   Ni   i    (   s   ranges   lens   selfs   filess   i(   s   selfs   is/   /mit/python/lib/python2.0/distutils/filelist.pys   remove_duplicatesX s   & 	"c    s~  a b t  i | ƒ } c | d } e t } } } g | d d d d f j oD i t	 | ƒ d j  o j t
 d | ‚ n m t t | d ƒ } nÕ o | d	 d
 f j oW p t	 | ƒ d j  o q t
 d | ‚ n t t | d ƒ } u t t | d ƒ } nh w | d d f j oA x t	 | ƒ d j o y t
 d | ‚ n | t | d ƒ } n  t
 d | ‚  | | | | f Sd  S(   Ni    s   includes   excludes   global-includes   global-excludei   s&   '%s' expects <pattern1> <pattern2> ...i   s   recursive-includes   recursive-excludei   s,   '%s' expects <dir> <pattern1> <pattern2> ...s   grafts   prunes#   '%s' expects a single <dir_pattern>s   unknown action '%s'(   s   strings   splits   lines   wordss   actions   Nones   patternss   dirs   dir_patterns   lens   DistutilsTemplateErrors   maps   convert_path(   s   selfs   lines   wordss   actions   patternss   dirs   dir_patterns/   /mit/python/lib/python2.0/distutils/filelist.pys   _parse_template_linea s$   c    sý  †  |  i | ƒ \ } } } } ’ | d j ol “ |  i d t i	 | ƒ ƒ ” xE | d ” r8 } • |  i | d d ƒo – |  i d | ƒ n qZ Wn]˜ | d j ol ™ |  i d t i	 | ƒ ƒ š xE | d š r8 } › |  i | d d ƒo œ |  i d	 | ƒ n qÖ Wná  | d
 j op ¡ |  i d t i	 | ƒ ƒ ¢ xI | d ¢ r< } £ |  i | d d ƒo ¤ |  i d d | ƒ n qRWna¨ | d j op © |  i d t i	 | ƒ ƒ ª xI | d ª r< } « |  i | d d ƒo ¬ |  i d d | ƒ n qÒWná° | d j o| ± |  i d | t i	 | ƒ f ƒ ³ xO | d ³ rB } ´ |  i | d | ƒo" µ |  i d d | | f ƒ n qXWnU¹ | d j o| º |  i d | t i	 | ƒ f ƒ ¼ xO | d ¼ rB } ½ |  i | d | ƒo" ¾ |  i d d | | f ƒ n qäWnÉ Â | d j oJ Ã |  i d | ƒ Ä |  i t d | ƒo Å |  i d | ƒ n no Ç | d j oN È |  i d | ƒ É |  i t d | ƒo Ê |  i d d | ƒ n n Î t d  | ‚ d  S(!   Ns   includes   include i    s   anchori   s   no files found matching '%s's   excludes   exclude s0   no previously-included files found matching '%s's   global-includes   global-include s   no files found matching '%s' s   anywhere in distributions   global-excludes   global-exclude s+   no previously-included files matching '%s' s   found anywhere in distributions   recursive-includes   recursive-include %s %ss   prefixs   under directory '%s's   recursive-excludes   recursive-exclude %s %ss   found under directory '%s's   grafts   graft s"   no directories found matching '%s's   prunes   prune s)   no previously-included directories found s   matching '%s's'   this cannot happen: invalid action '%s'(   s   selfs   _parse_template_lines   lines   actions   patternss   dirs   dir_patterns   debug_prints   strings   joins   patterns   include_patterns   warns   exclude_patterns   Nones   DistutilsInternalError(   s   selfs   lines   actions   patternss   dirs   dir_patterns   patterns/   /mit/python/lib/python2.0/distutils/filelist.pys   process_template_line† s\    	  	  	$ 	$# 	*# 	* c    sÐ   Ö ï ð d } ñ t | | | | ƒ } ò |  i d | i ƒ ö |  i	 t
 j o ÷ |  i ƒ  n ù x] |  i	 d ù rM } ú | i | ƒ o4 û |  i d | ƒ ü |  i i | ƒ ý d } n qq Wÿ | Sd S(   sƒ  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 1 if files are found.
        i    s%   include_pattern: applying regex r'%s's    adding i   N(   s   files_founds   translate_patterns   patterns   anchors   prefixs   is_regexs
   pattern_res   selfs   debug_prints   allfiless   Nones   findalls   names   searchs   filess   append(   s   selfs   patterns   anchors   prefixs   is_regexs   files_founds
   pattern_res   names/   /mit/python/lib/python2.0/distutils/filelist.pys   include_patternÖ s   	 	i   i    c    sÌ   d } t | | | | ƒ } |  i d | i ƒ x} t	 t
 |  i ƒ d d d ƒ d rU } | i |  i | ƒ o5 |  i d |  i | ƒ |  i | =d } n qe W| Sd S(   sþ   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 1 if files are found.
        i    s%   exclude_pattern: applying regex r'%s'i   s
    removing N(   s   files_founds   translate_patterns   patterns   anchors   prefixs   is_regexs
   pattern_res   selfs   debug_prints   ranges   lens   filess   is   search(   s   selfs   patterns   anchors   prefixs   is_regexs   files_founds
   pattern_res   is/   /mit/python/lib/python2.0/distutils/filelist.pys   exclude_patterns   	' 	(   s   __doc__s   Nones   __init__s   set_allfiless   oss   curdirs   findalls   _FileList__warns   _FileList__debug_prints   appends   extends   sorts   remove_duplicatess   _parse_template_lines   process_template_lines   include_patterns   exclude_pattern(    s/   /mit/python/lib/python2.0/distutils/filelist.pys   FileList s   		%P.c    sV   #$d k  l } l } l } l } &g  } '|  g } (| i } )| i	 } +xð +| oå ,| ƒ  }  -t i |  ƒ }	 /x½ |	 d /r° }
 0|  t i j o 1t i i |  |
 ƒ } n
 3|
 } 6t i  | ƒ } 7| | } 8| | ƒ o 9| i	 | ƒ n0 :| | ƒ o | | ƒ o ;| | ƒ n q Wq[ W=| Sd S(   s^   Find all files under 'dir' and return the list of full filenames
    (relative to 'dir').
    (   s   ST_MODEs   S_ISREGs   S_ISDIRs   S_ISLNKi    N(   s   stats   ST_MODEs   S_ISREGs   S_ISDIRs   S_ISLNKs   lists   dirs   stacks   pops   appends   pushs   oss   listdirs   namess   names   curdirs   paths   joins   fullnames   mode(   s   dirs   ST_MODEs   S_ISREGs   S_ISDIRs   S_ISLNKs   lists   stacks   pops   pushs   namess   names   fullnames   stats   modes/   /mit/python/lib/python2.0/distutils/filelist.pys   findall s,   "	 
 		c    s;   @EFt  i |  ƒ } Ot i d d | ƒ } P| Sd S(   sæ   Translate 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).
    s   (^|[^\\])\.s   \1[^/]N(   s   fnmatchs	   translates   patterns
   pattern_res   res   sub(   s   patterns
   pattern_res/   /mit/python/lib/python2.0/distutils/filelist.pys
   glob_to_re@s   	c    så   UZ[| o5 \t |  ƒ t j o ]t i |  ƒ Sn _|  Sn a|  o bt |  ƒ } n
 dd } f| t	 j	 o; gt | ƒ d d !} hd t i i | d | ƒ } n j| o kd | } n mt i | ƒ Sd S(   s  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).
    s    i    i   s   ^s   .*N(   s   is_regexs   types   patterns
   StringTypes   res   compiles
   glob_to_res
   pattern_res   prefixs   Nones	   prefix_res   oss   paths   joins   anchor(   s   patterns   anchors   prefixs   is_regexs
   pattern_res	   prefix_res/   /mit/python/lib/python2.0/distutils/filelist.pys   translate_patternUs   

	$
i   i    (   s   __doc__s   __revision__s   syss   oss   strings   res   fnmatchs   typess   globs   distutils.utils   convert_paths   distutils.errorss   DistutilsTemplateErrors   DistutilsInternalErrors   FileLists   curdirs   findalls
   glob_to_res   Nones   translate_pattern(    s/   /mit/python/lib/python2.0/distutils/filelist.pys   ? s   	'
ÿ  