;
Éâ"Ic            	   @   sž   d  Z  d d l Z d d l Z d d l Z d d g Z d d d d d d „ Z d d d d d „ Z d	 „  Z e	 d
 k o! e
 e ƒ  ƒ Z e j e ƒ n d S(   uí  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    Nu   compile_diru   compile_pathi
   c             C   s  | p t  d |  d ƒ n y t j |  ƒ } Wn* t j k
 o t  d |  ƒ g  } Yn X| j ƒ  d } x| D]} t j j |  | ƒ }	 | d k	 o t j j | | ƒ }
 n d }
 | d k	 o! | j |	 ƒ } | o qr qç n t j j	 |	 ƒ oû| d d … | d d … } } | d k oÉ|	 t
 o d p d	 } t j |	 ƒ j } y t j | ƒ j } Wn t j k
 o d
 } Yn X| | k o | o qr n | p t  d |	 d ƒ n y t j |	 d |
 d ƒ } Wnø t k
 o t ‚ Yqñt j k
 oY } zC | o t  d |	 d ƒ n t  d d d ƒt  | j ƒ d
 } WYd d } ~ Xqñt t t f k
 oc } zM | o t  d |	 d ƒ n t  d d d ƒt  | j j d | ƒ d
 } WYd d } ~ XqñX| d
 k o
 d
 } qñqwqr | d
 k ou | t j k oe | t j k oU t j j |	 ƒ oB t j j |	 ƒ o. t |	 | d |
 | | | ƒ p
 d
 } qwqr qr W| S(   uÁ  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

    u   Listingu   ...u
   Can't listi   Niýÿÿÿu   .pyu   cu   oi    u	   Compilingu   *** Error compilingu   *** u   endu    u   :T(   u   printu   osu   listdiru   erroru   sortu   pathu   joinu   Noneu   searchu   isfileu	   __debug__u   statu   st_mtimeu
   py_compileu   compileu   Trueu   KeyboardInterruptu   PyCompileErroru   msgu   SyntaxErroru   UnicodeErroru   IOErroru	   __class__u   __name__u   curdiru   pardiru   isdiru   islinku   compile_dir(   u   diru	   maxlevelsu   ddiru   forceu   rxu   quietu   namesu   successu   nameu   fullnameu   dfileu   mou   headu   tailu   cfileu   ftimeu   ctimeu   oku   erru   e(    (    u'   /mit/python/lib/python3.0/compileall.pyu   compile_dir   sr    
 !     i   c             C   sm   d } x` t  j D]U } | p | t j k o |  o t d ƒ q | o t | | d | d | ƒ} q W| S(   u  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   u   Skipping current directoryu   quietN(   u   sysu   pathu   osu   curdiru   printu   compile_diru   None(   u   skip_curdiru	   maxlevelsu   forceu   quietu   successu   dir(    (    u'   /mit/python/lib/python3.0/compileall.pyu   compile_path]   s    
 c              C   s?  d d l  }  y) |  j  t j d d … d ƒ \ } } Wn‘ |  j k
 o‚ } zl t | ƒ t d ƒ t d ƒ t d ƒ t d ƒ t d	 ƒ t d
 ƒ t d ƒ t d ƒ t j d ƒ WYd d } ~ Xn Xd } d } d } d } d } xœ | D]” \ }	 }
 |	 d k o
 d } n |	 d k o
 |
 } n |	 d k o
 d } n |	 d k o
 d } n |	 d k o d d l } | j |
 ƒ } qî qî W| o2 t	 | ƒ d k o t d ƒ t j d ƒ q¿n d } yO | o; xA | D], } t
 | | | | | | ƒ p
 d } qÖqÖWn
 t ƒ  } Wn$ t k
 o t d ƒ d } Yn X| S(   u   Script main program.i    Ni   u   lfqd:x:uS   usage: python compileall.py [-l] [-f] [-q] [-d destdir] [-x regexp] [directory ...]u   -l: don't recurse downu3   -f: force rebuild even if timestamps are up-to-dateu   -q: quiet operationu7   -d destdir: purported directory name for error messagesu4      if no directory arguments, -l sys.path is assumedu<   -x regexp: skip files matching the regular expression regexpu:      the regexp is searched for in the full path of the filei   i
   u   -lu   -du   -fu   -qu   -xu1   -d destdir require exactly one directory argumentu   
[interrupt](   u   getoptu   sysu   argvu   erroru   printu   exitu   Noneu   reu   compileu   lenu   compile_diru   compile_pathu   KeyboardInterrupt(   u   getoptu   optsu   argsu   msgu	   maxlevelsu   ddiru   forceu   quietu   rxu   ou   au   reu   successu   dir(    (    u'   /mit/python/lib/python3.0/compileall.pyu   mainq   sb    )








!  
 
 
 

 
u   __main__(   u   __doc__u   osu   sysu
   py_compileu   __all__u   Noneu   compile_diru   compile_pathu   mainu   __name__u   intu   exit_statusu   exit(    (    (    u'   /mit/python/lib/python3.0/compileall.pyu   <module>   s   G	0