Ñò
ïžòKc        	   @   sž   d  Z  d d k Z d d k Z d d k Z d d g Z d d d d d d „ Z d d d d d	 „ Z d
 „  Z e	 d j o! e
 e ƒ  ƒ Z e i e ƒ n d S(   sí  Module/script to "compile" all .py files to .pyc (or .pyo) file.

When called as a script with arguments, this compiles the directories
given as arguments recursively; the -l option prevents it from
recursing into directories.

Without arguments, if compiles all modules on sys.path, without
recursing into subdirectories.  (Even though it should do so for
packages -- for now, you'll have to deal with packages separately.)

See module py_compile for details of the actual byte-compilation.

iÿÿÿÿNt   compile_dirt   compile_pathi
   i    c         C   sè  | p d G|  Gd GHn y t  i |  ƒ } Wn% t  i j
 o d G|  GHg  } n X| i ƒ  d } x~| D]v} t  i i |  | ƒ }	 | d j	 o t  i i | | ƒ }
 n d }
 | d j	 o! | i |	 ƒ } | o qj qß n t  i i |	 ƒ ol| d  | d } } | d j oF|	 t	 o d p d } t  i
 |	 ƒ i } y t  i
 | ƒ i } Wn t  i j
 o d	 } n X| | j o | o qj n | p d
 G|	 Gd GHn y t i |	 d |
 t ƒ } Wny t j
 o t ‚ qZt i j
 o/ } | o d
 G|	 Gd GHn | i GHd	 } qZt j
 o } d G| GHd	 } qZX| d	 j o
 d	 } qZqàqj | d	 j ou | t  i j oe | t  i j oU t  i i |	 ƒ oB t  i i |	 ƒ o. t |	 | d |
 | | | ƒ p
 d	 } qàqj qj W| S(   sÁ  Byte-compile all modules in the given directory tree.

    Arguments (only dir is required):

    dir:       the directory to byte-compile
    maxlevels: maximum recursion level (default 10)
    ddir:      if given, purported directory name (this is the
               directory name that will show up in error messages)
    force:     if 1, force compilation, even if timestamps are up-to-date
    quiet:     if 1, be quiet during compilation

    t   Listings   ...s
   Can't listi   iýÿÿÿs   .pyt   ct   oi    t	   Compilingt   SorryN(   t   ost   listdirt   errort   sortt   patht   joint   Nonet   searcht   isfilet	   __debug__t   statt   st_mtimet
   py_compilet   compilet   Truet   KeyboardInterruptt   PyCompileErrort   msgt   IOErrort   curdirt   pardirt   isdirt   islinkR    (   t   dirt	   maxlevelst   ddirt   forcet   rxt   quiett   namest   successt   namet   fullnamet   dfilet   mot   headt   tailt   cfilet   ftimet   ctimet   okt   errt   e(    (    s    scripts/common/Lib/compileall.pyR       sj    	
    

	  i   c         C   sh   d } x[ t  i D]P } | p | t i j o |  o	 d GHq | o t | | d | d | ƒ} q W| S(   s  Byte-compile all module on sys.path.

    Arguments (all optional):

    skip_curdir: if true, skip current directory (default true)
    maxlevels:   max recursion level (default 0)
    force: as for compile_dir() (default 0)
    quiet: as for compile_dir() (default 0)

    i   s   Skipping current directoryR#   N(   t   sysR   R   R   R    R   (   t   skip_curdirR   R!   R#   R%   R   (    (    s    scripts/common/Lib/compileall.pyR   W   s    
 	c          C   sï  d d k  }  y# |  i  t i d d ƒ \ } } WnR |  i j
 oC } | GHd GHd GHd GHd GHd	 GHd
 GHd GHd GHt i d ƒ n Xd } d } d } d } d } xœ | D]” \ }	 }
 |	 d j o
 d } n |	 d j o
 |
 } n |	 d j o
 d } n |	 d j o
 d } n |	 d j o d d k } | i |
 ƒ } q© q© W| o- t | ƒ d j o d GHt i d ƒ qun d } yO | o; xA | D], } t	 | | | | | | ƒ p
 d } qŒqŒWn
 t
 ƒ  } Wn t j
 o d GHd } n X| S(   s   Script main program.iÿÿÿÿNi   s   lfqd:x:sS   usage: python compileall.py [-l] [-f] [-q] [-d destdir] [-x regexp] [directory ...]s   -l: don't recurse downs3   -f: force rebuild even if timestamps are up-to-dates   -q: quiet operations7   -d destdir: purported directory name for error messagess4      if no directory arguments, -l sys.path is assumeds<   -x regexp: skip files matching the regular expression regexps:      the regexp is searched for in the full path of the filei   i
   i    s   -ls   -ds   -fs   -qs   -xs1   -d destdir require exactly one directory arguments   
[interrupt](   t   getoptR2   t   argvR	   t   exitR   t   reR   t   lenR    R   R   (   R4   t   optst   argsR   R   R    R!   R#   R"   R   t   aR7   R%   R   (    (    s    scripts/common/Lib/compileall.pyt   maink   sb    #  
 
 
 
 t   __main__(   t   __doc__R   R2   R   t   __all__R   R    R   R<   t   __name__t   intt   exit_statusR6   (    (    (    s    scripts/common/Lib/compileall.pyt   <module>   s   A	0