
"Pc           @   s  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 m
 Z
 m Z d  d l Z d  d l Z d  d l m Z m Z m Z d  d l m Z m Z m Z m Z m Z d  d l m Z m Z d  d l j Z d  d l m Z m Z d  d l m Z d  d l m  Z  d  d l! j" Z# e rad  d	 l m$ a$ n  e# j% d
  Z& e' d  Z( e' e) f  Z* e+ d  \ Z, Z- e j. j/ d d d d  Z0 e) a1 e) a2 e) a3 e) a4 e) a5 g  a6 i  a7 d   Z8 d   Z9 d   Z: d   Z; d   Z< d   Z= d   Z> d   Z? d d  Z@ d d  ZA d   ZB d   ZC d   ZD d f  d      YZE d! eE f d"     YZF d#   ZG d$ eE f d%     YZH d&   ZI d d e) d'  ZJ e+ d(  \ Z, Z- ZK d) eE f d*     YZL d+ eE f d,     YZM d- eM f d.     YZN d/ eE f d0     YZO d1 eE f d2     YZP d3 e j f d4     YZQ d5 eE eQ f d6     YZR d7 eS f d8     YZT d9   ZU d:   ZV d;   ZW d<   ZX eY d=  ZZ d S(>   iN(   t   archivet   carchive(   t   HOMEPATHt	   CONFIGDIRt   PLATFORM(   t   is_wint   is_unixt   is_aixt	   is_darwint	   is_cygwin(   t   is_py23t   is_py24(   t   hashlibt   set(   t   dylib(   t   misc(   t   winmanifests   PyInstaller.buildt    i   t   SPECPATHt   builds   pyi.TARGET_PLATFORMt   SPECNAMEc         C   sa   t  j j |   } t  j j |  s4 t  j |  n  t |  d  } t j | |  | j   d  S(   Nt   w(   t   ost   patht   dirnamet   existst   makedirst   opent   pprintt   close(   t   filenamet   dataR   t   outf(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt
   _save_dataJ   s    c         C   s   t  t |  d  j    S(   Nt   rU(   t   evalR   t   read(   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt
   _load_dataS   s    c          C   sS   t  j d d  }  t r+ t r+ d |  }  n  d |  }  d |  }  t  j d |   d  S(   Nt   UPXR   s   --strip-loadconf s   --compress-icons=0 s   --best (   t   compatt   getenvR   R   t   setenv(   t   f(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   setupUPXFlagsW   s    

c         C   s$   y t  j |   d SWn d SXd  S(   Ni   i    (   R   t   stat(   t   fnm(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   mtimee   s    c         C   s   t  j j t  j j |    S(   N(   R   R   t   abspatht   normpath(   t   apath(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   absnormpathl   s    c         C   s  t  j j t d  } g  } x|  D]\ } } } | d k rY | j | | | f  q" n  | d  } t |  t |  k p t | d  j   d  t j	   k } | ry$ t
 j | |  t j d |  Wqt k
 rt  j j |  d } d | k r&| j d	  d  | j d	  d }	 }
 n | j d	  d }	 }
 t  j j | |	  }	 t  j j |	  sst  j |	  n  t  j j |	 |
 |  } t |  t |  k pt | d  j   d  t j	   k } | rt
 j | |  t j d |  qqXn  | j | | | f  q" W| S(
   s   Given a TOC or equivalent list of tuples, generates all the required
    pyc/pyo files, writing in a local directory if required, and returns the
    list of tuples with the updated pathnames.
    t
   localpycost   PYMODULEit   rbi   s   compiled %si   t   __init__t   .(   R   R   t   joint	   BUILDPATHt   appendR.   R   R$   t   impt	   get_magict
   py_compilet   compilet   loggert   debugt   IOErrort   splitextt   splitR   R   (   t   toct   basepatht   new_toct   nmR-   t   typt
   source_fnmt   needs_compilet   extt   leadingt   mod_name(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   compile_pycosp   s:    	
%*%c         C   s   t    } x{ |  D]s \ } } } | d k rm t j j |  d } t j j |  d | k sm | | } qm n  | j | | | f  q W| S(   sK   
    Returns a new TOC with proper library suffix for EXTENSION items.
    t	   EXTENSIONt
   DEPENDENCYi   (   RO   RP   (   t   TOCR   R   RB   R:   (   RD   RF   t   inmR-   RH   t   binext(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   addSuffixToExtensions   s    	c         C   s$   | | k r  t  j d |   t St S(   s.   
    rebuild is required if values differ
    s   building because %s changed(   R?   t   infot   Truet   False(   t   attrt   oldt   newt
   last_build(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   _check_guts_eq   s    i    c         C   sx   xq | D]i \ } } } t  |  | k r< t j d |  t S| r t  | d   | k r t j d | d   t Sq Wt S(   s   
    rebuild is required if mtimes of files listed in old toc are newer
    than ast_build

    if pyc=1, check for .py files, too
    s   building because %s changedi(   R.   R?   RU   RV   RW   (   RX   RY   RD   R[   t   pycRG   R-   RH   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   _check_guts_toc_mtime   s    c         C   s.   t  |  | | |  p- t |  | | | d | S(   s   
    rebuild is required if either toc content changed if mtimes of
    files listed in old toc are newer than ast_build

    if pyc=1, check for .py files, too
    R]   (   R\   R^   (   RX   RY   RD   R[   R]   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   _check_guts_toc   s    c         C   s   d } t  j |   r5 t j d |  t   | d 7} n  t j |   rd t j d |  t  | d 7} n  | r} t d t   n  t S(   s   
    Check that path does not overlap with BUILDPATH or SPECPATH (i.e.
    BUILDPATH and SPECPATH may not start with path, which could be
    caused by a faulty hand-edited specfile)

    Raise SystemExit if there is overlap, return True otherwise
    i    s<   Specfile error: The output path "%s" contains BUILDPATH (%s)i   s;   Specfile error: The output path "%s" contains SPECPATH (%s)s\   Error: Please edit/recreate the specfile (%s) and set a different output name (e.g. "dist").(   R9   t
   startswithR?   t   errorR   t
   SystemExitt   SPECRV   (   R   t   specerr(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   _check_path_overlap   s    	
	
c         C   s   t  r d } n2 t j j   r1 t d |   } n t d |    | j   j   d k ry t j	 d |   t
 j |   n t d   d S(   sq   
    Remove directory and all its contents, but only after user confirmation,
    or if the -y option is set
    t   ysX   WARNING: The output directory "%s" and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)s   Error: The output directory "%s" is not empty. Please remove all its contents or use the -y option (remove output directory without confirmation).s   Removing dir %ss   User abortedN(   t	   NOCONFIRMt   syst   stdoutt   isattyt	   raw_inputRb   t   stript   lowerR?   RU   t   shutilt   rmtree(   R   t   choice(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   _rmtree   s    	
c         C   s   t  rW t j j r3 |  j t j j t j j  }  n  |  j t j j  } t j j } n0 |  j d d  j d  } d } t r d } n  xq t t	 d t
 |   |  D]Q \ } } | j   j d  r | j | | d   } t j j |  r t Sq q Wt S(   sW   Check if path points to a file inside a python egg file (or to an egg
       directly).s   \t   /i    s   .eggi   (   R
   R   R   t   altsept   replacet   sepRC   R   t   zipt   ranget   lenRm   t   endswithR8   t   isfileRV   RW   (   t   ptht
   componentsRu   t   it   namet   eggpth(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt	   check_egg  s    !	+t   Targetc           B   s;   e  Z d  Z d   Z d   Z g  Z d   Z d d  Z RS(   i    c         C   st   |  j  j |  _ |  j  j d 7_ t j j t d |  j |  j  j f  |  _ t j j |  j  |  _	 t
   |  _ d  S(   Ni   s   out%02d-%s.toc(   t	   __class__t   invcnumR   R   R8   R9   t   __name__t   outt   basenamet   outnmRQ   t   dependencies(   t   self(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6   .  s    c         C   s?   t  j d |  j j  |  j t |  j   r; |  j   n  d  S(   Ns   checking %s(   R?   RU   R   R   t
   check_gutsR.   R   t   assemble(   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   __postinit__8  s    c         C   s   d  S(   N(    (   R   R[   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR   ?  s    s   missing or badc         C   s   y t  |  j  } Wn* t j d t j j |  j  |  d SXt |  t |  j	  k rr t j d |  j
  d Sx[ t |  j	  D]J \ } \ } } | d k r q n  | | | | t |  |  |  r d Sq W| S(   s3   
        returns None if guts have changed
        s   building because %s %ss   building because %s is badN(   R%   R   R?   RU   R   R   R   t   NoneRx   t   GUTSR   t	   enumeratet   getattr(   R   R[   t   missingR   R}   RX   t   func(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   get_gutsB  s    """(   R   t
   __module__R   R6   R   R   R   R   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR   +  s   	
		t   Analysisc           B   sg  e  Z e e e j j e d  d   e e j j e d  d   e e j j e d  d   e e j j e d  d   e e j j e d  d   e e j j e d  d   e e j j e d  d   f  Z	 d d d d d d  Z d e f d e f d	 e f d
 e f d e f d d   f d e f d e f d e f d e f f
 Z d   Z d   Z d   Z RS(   t   supports   _mountzlib.pys   useUnicode.pys   useTK.pys   unpackTK.pys   removeTK.pyc   	      C   s  t  j |   t j j t d d  } t j j t d d  t j j | d  t j j | d  t j j | d  g |  _ xn | D]f } t |  |  j k r t	 j
 d |  q n  t j j |  s t d	 |   n  |  j j |  q Wg  |  _ | rg  | D] } t |  ^ q |  _ n  | p'g  |  _ |  j j t  | |  _ | |  _ t   |  _ t   |  _ t   |  _ t   |  _ t   |  _ t   |  _ |  j   d  S(
   Nt   PyInstallert   loaderR   s   _pyi_bootstrap.pys
   archive.pys   carchive.pys   iu.pys&   Ignoring obsolete auto-added script %ss   script '%s' not found(   R   R6   R   R   R8   R   t   inputsR2   t   _old_scriptsR?   t   warnR   t
   ValueErrorR:   t   pathext   hiddenimportst   extendt   HIDDENIMPORTSt	   hookspatht   excludesRQ   t   scriptst   puret   binariest   zipfilest   datasR   R   (	   R   R   R   R   R   R   t   _init_code_patht   scriptR   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6   c  s6    	%		R   R   R   R   R   R   c          G   s   t  t |  i d d 6 S(   Ni   R]   (   t   applyR^   (   t   args(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   <lambda>  s   R   R   R   R   c   
      C   s   | d k r, t  j d |  j j |  j  t Sx7 |  j D], } t |  | k r6 t  j d |  t Sq6 Wt j	 |  |  } | s t S| d \ } } } } } }	 t
 |  |  _ t
 |  |  _ t
 |  |  _ t
 |  |  _ t
 |  |  _ |	 |  _ t S(   Ni    s#   building %s because %s non existents   building because %s changedi(   R?   RU   R   R   R   RV   R   R.   R   R   RQ   R   R   R   R   R   R   RW   (
   R   R[   R-   R   R   R   R   R   R   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s$    	c         C   sE  t  j d t j j |  j   i  t _ t j	 } t
 s x@ t j j |  ry t j j t j j |  t j |   } q: Wd  } nF t j d d d t d t j   d d   } t j j t t d	  | _ g  } | j t j d
 | d
 f g d | d  i  } g  } x |  j D] } t j j |  s<t d |   n  t j j |  \ } } | sit j   } n  t |  } t j j |  \ }	 }
 d | | <| j |	  qWt  j! j" j# | j$   |  j% |  j& |  j'  } |  j% t  _( g  } xT t) |  j  D]C \ } } t  j d |  | j* |  | j | | | d f  qWg  t  _( xu |  j+ D]j } | | j, k r~t  j d |  qSn  t  j d |  | j- |  | | j, k rSt  j. d |  qSqSWg  } g  } g  } g  } t  j d  x0 | j, j/   D] \ } } | j t0 |   qWx4 | D], \ } } } t  j d |  | j* |  q Wx;| j, j/   D]*\ } } | d  k r~q`n  | j | j1  t2 | t  j! j, j3  rq`t2 | t  j! j, j4  r| j | j5 | j6 d f  | j | j7  q`t2 | t  j! j, j8 t  j! j, j9 f  rR| j d t j j t: | j;   t: | j;  d f  q`| j | j7  | d k r`| j | | j6 d f  q`q`W| j t j | d |  t
 r| j<   n  |  j= |  | r| j> d d t j j t? d  d f  n  | | d d +t@ |  |  _A t@ |  |  _B t@ |  |  _7 t@ |  |  _C t@ |  |  _1 y tD |  j  } Wn d  } n Xt@ tE |  jB   |  _B tF g  |  jG D] } tH |  | d  ^ q } | | k r.tI |  j |  tJ tK d  } x% | jL   D] } | jM | d  qW| jN   t  j d tK  d St  j d |  j  d S(!   Ns   running Analysis %st   type_t   win32R~   t   processorArchitecturet   versioni   i    s   .exe.manifestR   t   manifests%   Error: Analysis: script %s not found!s   Analyzing %st   PYSOURCEs)   Hidden import %r has been found otherwises   Analyzing hidden import %rs   Hidden import %r not founds   Looking for run-time hookss   Analyzing rthook %sRO   s   eggs/t   ZIPFILEt   __main__R4   is   _pyi_egg_install.pys   support/_pyi_egg_install.pyR   s   
s   Warnings written to %ss   %s no change!(   i   i    i    i    (O   R?   RU   R   R   R   R   t	   bindependt   seenRh   t
   executableR   t   islinkR8   R   t   readlinkR   R   t   Manifestt   specnmt   processor_architectureR9   R   R   t   DependenciesR   R   Rb   RC   t   getcwdR2   RB   R:   R   t   dependt
   imptrackert   ImportTrackert   keysR   R   R   t
   __pathex__R   t   analyze_scriptR   t   modulest   analyze_oneRa   t   itemst   _findRTHookR   t
   isinstancet   BuiltinModulet   ExtensionModuleR   t   __file__R   t   PkgInZipModulet   PyInZipModulet   strt   ownert   writeprettyxmlt   fixMissingPythonLibt   insertR   RQ   R   R   R   R%   RN   t   tupleR   R   R!   R   t   WARNFILEt   getwarningst   writeR   (   R   t   pythont   depmanifestR   t   dirst   pynmsR   t   dt   baset   pynmRK   t   importTrackerR   R}   t   modnmR   R   R   t   rthookst   modt   hook_modt	   hook_filet   mod_typet   oldstufft   gt   newstufft   wft   ln(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s    		.		
"	'" 
+
/
c   	      C   s  t  r d t j d  f } nA t r: d t j d  f } n$ t rZ d d t j d  f } n d SxD | D]< \ } } } x* | D]" } | d k r{ | | k r{ d Sq{ Wqe W| d } t j d	 |  t r t j |  } | d k r_t
 d
   q_nm t r_t j rt j } n	 t j } t j d |  t j j | |  } t j j |  s_t
 d
   q_n  | j t j j |  | d f  d S(   s~  Add the Python library if missing from the binaries.

        Some linux distributions (e.g. debian-based) statically build the
        Python executable to the libpython, so bindepend doesn't include
        it in its output.

        Darwin custom builds could possibly also have non-framework style libraries,
        so this method also checks for that variant as well.
        s   libpython%d.%d.ai   s   libpython%d.%d.sot   Pythons   libpython%d.%d.dylibNt   BINARYi    s   Looking for Python library %ss   Python library not found!s    Looking for Python library in %s(   R   Rh   t   version_infoR   R   R?   RU   R   t   findLibraryR   RA   R'   t   is_virtualenvt   real_prefixt   prefixR   R   R8   R   R:   R   (	   R   R   t   namesRG   R-   RH   R~   t   libt	   py_prefix(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR   9  s4    
		N(   R   R   R   R2   R   R   R8   R   R   R   R   R6   R\   R^   R   R   R   R   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR   X  s.   $	#										c         C   s   g  } x t  j |   p g  D]t } t j j |  } t j j |  d } t j j |  re | } n t j j t |  } | j	 | | d f  q W| S(   Ni    R   (
   R   t   getR   R   R   RB   t   isabsR8   R   R:   (   R   t   rsltR   RG   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR   y  s    	t   PYZc           B   s\   e  Z d  Z d	 d d	 d  Z d e f d e f d e f d e f f Z d   Z d   Z	 RS(
   R   i	   c         C   s   t  j |   | |  _ | |  _ | d  k rB |  j d  d |  _ n  | |  _ t d ry | d  k	 ry t j	 |  j
 |  _ n	 d  |  _ t t d  |  _ |  j   d  S(   Nit   pyzt   useCryptt   PYZ_dependencies(   R   R6   RD   R~   R   R   t   levelt   configR    t   Keyfilet   keyt   cryptRN   R   R   (   R   RD   R~   R   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6     s    				R~   R   R   RD   c         C   s^   t  j j |  j  s> t j d |  j t  j j |  j   t St	 j
 |  |  } | sZ t St S(   Ns#   rebuilding %s because %s is missing(   R   R   R   R~   R?   RU   R   R   RV   R   R   RW   (   R   R[   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s    	c         C   s   t  j d t j j |  j   t j d |  j d |  j	  } |  j
 t d } | j |  j |  t |  j |  j |  j |  j	 |  j
 f  d S(   Ns   building PYZ %sR   R   R   i   (   R?   RU   R   R   R   R   R    t   ZlibArchiveR   R   RD   R   R   R~   R!   (   R   R   RD   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s    (N(
   R   R   RH   R   R6   R\   R_   R   R   R   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s   				c         C   s.   t  |  d  j   } t j |  j   } | S(   NR5   (   R   R$   R   t   md5t   digest(   R-   R   R  (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   cacheDigest  s    c         C   s[  | r | r t  r t s1 |  j   j d  r5 |  S| rD d } n d } | rY d } n d } d t j d t j d f } t j j t	 d | | | f  } t j j
 |  s t j |  n  t j j | d  } t j j
 |  r t |  } n i  } t j j t j j |    } t |   }	 t j j | |  }
 d } | | k r|	 | | k rnt j |
  qt  rt j |
 |  n  |
 Sn  | r#| rt |  d d  }  n  d } t d d k rt j d
 k rd } n  d } t j d  rt j j t d |  } n  | | d |
 g } n | r;d d |
 g } n  t j |  |
  t j |
 d  t r|  j   j d  ry t j t j j |
   } WnN t j  j! k
 r} | j" d t j# k rqt$ j! t j j |
     qXt j% | k rt& | t j%  rx| t j% D]} x| t j% | D]} yb t j'   } d j |
 t( t j%  t( |  t( |  g  | _) | j* | t j% | | t+  Wn@ t, k
 r} t$ j! d | |  t$ j! |
  t$ j- |  q.Xt& | j.  } t/ g  | j. D] } | j ^ q } xV t D]N } | j | k rt$ j0 d | j |
  | j. j1 |  | j2 | j  qqWt& | j.  | k r.y) | j3 t j j |
  | g | g  Wqt, k
 r} t$ j! t j j |
     qXq.q.WqWqn  | r'y t4 j5 |   Wq't6 k
 r#} t7 d |   q'Xn  |	 | | <t8 | |  t  rWt j |
 |  n  |
 S(   s  
    Cache prevents preprocessing binary files again and again.

    'dist_nm'  Filename relative to dist directory. We need it on Mac
               to determine level of paths for @loader_path like
               '@loader_path/../../' for qt4 plugins.
    s	   .manifesti   i    s   py%d%ss   bincache%d%d_%ss	   index.dats   --bestt   hasUPXi   t   nts   --lzmat   upxt   upx_dirs   -qRl   s   -Si  s   .pydt   :s*   Cannot parse manifest resource %s, %s froms'   Adding %r to dependent assemblies of %rs   Execution failed: %sN(   i   (9   R   R   Rm   Ry   Rh   R   R   R   R8   R   R   R   R%   t   normcaseR   R  R   t   removeR   t   mac_set_relative_dylib_depst
   checkCacheR   R~   R   Rn   t   copy2t   chmodt   pyasmR   t   GetManifestResourcesR/   t   winresourcet
   pywintypesRa   R   t   ERROR_BAD_EXE_FORMATR?   t   RT_MANIFESTRx   R   R   R   t   parse_stringRW   t	   Exceptiont	   exceptiont   dependentAssembliesR   RU   R:   t   updatet   update_resourcesR'   t   exec_commandt   OSErrorRb   R!   (   R-   Rl   R  t   dist_nmt   pyvert   cachedirt   cacheindexfnt   cache_indext   basenmR  t
   cachedfilet   cmdt   bestoptt   upx_executablet   rest   eR~   t   languageR   t   exct   olent   dept	   _depNamest   pydep(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR    s    		"	"			
	
i   t   PKGc           B   s   e  Z d  Z i
 d d 6d d 6d d 6d d 6d	 d  6d
 d 6d d 6d d 6d d 6d d 6Z d d d d d d d  Z d e f d e f d e f d e f d e f d e f d e f f Z d   Z	 d   Z
 RS(   R0  t   mR4   t   sR   t   bRO   t   zR   t   at   xt   DATAR   t   ZR   t
   EXECUTABLER   RP   i    c         C   s   t  j |   | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | d  k ro |  j
 d  d |  _ n  |  j d  k r i t d 6t d 6t d 6t d 6t d 6t d 6|  _ |  j r t |  j d <t |  j d <q n  |  j   d  S(	   Nit   pkgRO   R7  R   R9  R   R4   (   R   R6   RD   t   cdictR~   t   exclude_binariest   strip_binariest   upx_binariesR   R   R   t
   COMPRESSEDt	   ENCRYPTEDR   (   R   RD   R~   R;  R<  R=  R>  R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6   Z  s*    							
	R~   R;  RD   R<  R=  R>  R   c         C   s^   t  j j |  j  s> t j d |  j t  j j |  j   d St j	 |  |  } | sZ t
 St S(   Ns#   rebuilding %s because %s is missingi   (   R   R   R   R~   R?   RU   R   R   R   R   RV   RW   (   R   R[   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR   {  s    	c   
      C   s,  t  j d t j j |  j   g  } g  } i  } t |  j  } xn| D]f\ } } } t j j |  r{ t	 |  r{ qG n  | d k rN|  j
 r | d k r |  j j | | | f  qt | |  j |  j o t s t o t d d | } | d k r
| | k r
qG n  d | | <| j | | |  j j | d  |  j j | d	  f  qG | d
 k rv| j | d d d f  qG | j | | |  j j | d  |  j j | d	  f  qG Wt j   } | j |  j |  t |  j |  j |  j |  j |  j
 |  j |  j |  j f  x | D] }	 t j |	  qWd S(   Ns   building PKG %sR   RO   RP   R  R  i   i    R3  t   OPTIONR   t   o(   s   BINARYs	   EXTENSIONs
   DEPENDENCY(   R?   RU   R   R   R   R~   RT   RD   Rz   R   R<  R   R:   R  R=  R>  R   R	   R   R;  R   t	   xformdictR   t   CArchiveR   R!   R   R   R  (
   R   t   trasht   mytocR   RD   RR   R-   RH   R    t   item(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s<    
;	N(   R   R   RH   RC  R   R6   R\   R^   R   R   R   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR0  M  s,   

								t   EXEc           B   s   e  Z d  Z d Z d Z d   Z d e f d e f d e f d e f d e f d	 e f d
 e f d e f d e f d f
 Z d   Z	 d   Z
 d   Z d   Z RS(   R9  i    i   c         O   s  t  j |   | j d d  |  _ | j d d  |  _ | j d d   |  _ | j d d   |  _ | j d d   |  _ | j d d   |  _	 | j d	 g   |  _
 | j d
 d   |  _ | j d d   |  _ | j d d  |  _ | j d d  |  _ | j d |  j  |  _ |  j d  k r2|  j d  d |  _ n  t j j |  j  set j j t |  j  |  _ n  t sqt r|  j d  d |  _ n |  j d |  _ t   |  _ x | D] } t | t  r|  j j |  qt | t   r&|  j j t j j | j  | j | j f  |  j j | j   q|  j j |  qWt rt j j t! t" d  } t# j$ | |  j	 |  j  |  _	 |  j j t j j |  j  d | d f  n  t% |  j d | j d d   d |  j d |  j d |  j d |  j |  _& |  j& j  |  _  |  j'   d  S(   Nt   consolei   R@   i    R~   t   iconR   R   t	   resourcesRl   R  R   R<  t
   append_pkgit   exeR:  s   .pkgs   .exe.manifests	   .manifestR   R;  R=  R>  ((   R   R6   R   RI  R@   R   R~   RJ  t   versrsrcR   RK  Rl   R  R   R<  RL  R   R   R   R   R8   R   R   R	   t   pkgnameRQ   RD   R   R   R:   R   RH   R   R9   R   R   t   create_manifestR0  R:  R   (   R   R   t   kwst   argR   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6     sP    ."	R~   RI  R@   RJ  RN  RK  Rl   R  R   t   mtmc         C   sy  t  j j |  j  s> t j d |  j t  j j |  j   d S|  j r t  j j |  j	  r t j d t  j j |  j	   d St
 j |  |  } | s t S| d d !\ } } } | s | s | r t d r t j d  n  | d } | d	 } | |  j k rt j d
 |  j  d S| t |  j  k rFt j d |  j  t S| t |  j j  k  rut j d |  j  t St S(   Ns    rebuilding %s because %s missingi   s   rebuilding because %s missingi   i   t   hasRsrcUpdatesE   ignoring icon, version, manifest and resources = platform not capableiis*   rebuilding %s because crypt option changeds(   rebuilding %s because mtimes don't matchs(   rebuilding %s because pkg is more recent(   R   R   R   R~   R?   RU   R   R   RL  RO  R   R   RV   R   R   R.   R:  R   RW   (   R   R[   R   RJ  RN  RK  RS  R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s4    	 	

c         C   sE   |  j  s | d } n  |  j r, | d } n  t j j d d t |  S(   NR   t   _dR   R   (   RI  R@   R   R   R8   R   (   R   RM  (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   _bootloader_file  s
    		c         C   s  t  j d t j j |  j   g  } t j j t j j |  j   se t j	 t j j |  j   n  t
 |  j d  } |  j d  } t j j t |  } t s t r | d } n  t d rR|  j s |  j s |  j rRt j   } t j | |  t j | d  |  j r$t j | |  j  n  |  j rCt j | |  j  n  x|  j D]} | j d  } xI t d t |   D]2 } y t | |  | | <Wqxt  k
 rqxXqxW| d	 } d  } }	 }
 t |  d k r| d } n  t |  d
 k r| d
 }	 n  t |  d k r#| d }
 n  y8 t" j# | | | p;d g |	 pGd g |
 pSd g  WqMt" j$ j% k
 r7} | j& d	 t" j' k rt  j( |  qMn  | s|	 rt  j% d  qMn  d | |	 f k rt  j% d  qMn  y) t" j) | | | |	 g |
 pd	 g  Wq8t" j$ j% k
 r3} t  j( |  q8XqMXqMW| j* |  | } n  t+ | |  j, |  j- ont d  } |  j. | |  |  j/ rt  j d |  j  |  j. |  j0 j |  n, t  j d |  j1  t j |  j0 j |  j1  | j2   t j |  j d  |  j |  j3 |  j4 |  j |  j |  j |  j, |  j- |  j5 t6 |  j  f
 } t |  t |  j7  k skt8  t9 |  j |  x | D] } t j: |  qWd S(   Ns   building EXE from %st   wbt   runs   .exeRT  i  t   ,i   i    i   i   t   *s'   resource type and/or name not specifieds[   no wildcards allowed for resource type and name when source file does not contain resourcesR  s   Appending archive to EXE %ss   Copying archive to %s(;   R?   RU   R   R   R   R   R   R   R~   R   R   RV  R8   R   R   R	   R   RJ  RN  RK  t   tempfilet   mktempRn   R  R  t	   CopyIconst   versioninfot
   SetVersionRC   Rw   Rx   t   intR   R   R  t   UpdateResourcesFromResFileR  Ra   R   R  R  t   UpdateResourcesFromDataFileR:   R  Rl   R  t   copyRL  R:  RO  R   RI  R@   R   R.   R   t   AssertionErrorR!   R  (   R   RE  R    RM  t   tmpnmR(  R}   t   resfilet   restypet   resnamet   reslangR+  t   gutsRG  (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s    !			
		"	
!c         C   s?   t  | d  } x) | j d  } | s+ Pn  | j |  q d  S(   NR5   i@   i   i   (   R   R$   R   (   R   R-   R    t   infR   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyRc  c  s    N(   s   mtmN(   R   R   RH   R<  RL  R6   R\   R   R   R   RV  R   Rc  (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyRH    s$   	,											!		Pt   DLLc           B   s   e  Z d    Z RS(   c         C   s   t  j d t j j |  j   t |  j d  } |  j d  } t j j	 t
 |  d } |  j | |  |  j |  j j |  | j   t j |  j d  t |  j |  j |  j |  j |  j |  j |  j |  j |  j |  j t |  j  f
  d S(   Ns   building DLL %sRW  t
   inprocsrvrs   .dlli  i   (   R?   RU   R   R   R   R   R   R~   RV  R8   R   Rc  R:  R   R  R!   RI  R@   RJ  RN  R   RK  Rl   R  R.   (   R   R    t   dll(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR   m  s    
	1(   R   R   R   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyRl  l  s   t   COLLECTc           B   sM   e  Z d    Z d e f d e f d e f d e f f Z d   Z d   Z RS(   c         O   s  t  j |   | j d d   |  _ |  j d  k rH d |  j d  |  _ n  | j d d  |  _ | j d d  |  _ t j	 j
 |  j  s t j	 j t |  j  |  _ n  t   |  _ x4| D],} t | t  r |  j j |  q t | t   r|  j j t j	 j | j  | j | j f  t | t  rxU | j D]J \ } } } | t j	 j | j  d k r6|  j j | | | f  q6q6W| j s|  j j t j	 j | j  | j d f  qn  |  j j | j  q |  j j |  q W|  j   d  S(	   NR~   t   dist_iRl   i    R  s	   .manifestR0  (   R   R6   R   R   R~   R   R=  R>  R   R   R   R8   R   RQ   RD   R   R   R:   R   RH   RH  RL  RO  R   R   (   R   R   RQ  RR  t   tocnmR-   RH   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6   }  s.    . 	1R~   R=  R>  RD   c         C   s   d S(   Ni   (    (   R   R[   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s    c         C   s  t  |  j  r4 t j j |  j  r4 t |  j  n  t j d t j j |  j	   t j
 |  j  t |  j  } x	| D]\ } } } t j j |  r t |  r qy n  t j j |  j |  } t j j |  } t j j |  s t j
 |  n  | d	 k r<t | |  j |  j o-t s&t o-t d d | } n  | d k r[t j | |  n  | d
 k ry t j | d  qy qy Wt |  j	 |  j |  j |  j |  j f  d S(   Ns   building COLLECT %sRO   R   R  R  RP   i  i   (   s	   EXTENSIONs   BINARY(   s	   EXTENSIONs   BINARY(   Re   R~   R   R   t   isdirRq   R?   RU   R   R   R   RT   RD   Rz   R   R8   R   R   R  R=  R>  R   R	   R   Rn   R  R  R!   (   R   RD   RR   R-   RH   t   tofnmt   todir(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s.    $	(   R   R   R6   R\   R   R   R   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyRo  |  s   					t   BUNDLEc           B   s2   e  Z d    Z d e f f Z d   Z d   Z RS(   c         O   s1  t  s
 d  S| j d t j j t j j t  d d d d   |  _ t j	 |   | j d d   |  _ |  j d  k	 r t j j t j j |  j   d |  _ n  | j d d	  |  _ t   |  _ x | D] } t | t  r |  j j t j j | j  | j | j f  |  j j | j  q t | t  rB|  j j |  q t | t  rg|  j j | j  q t j d
 | j j  q Wx |  j D] \ } } } | d k r| |  _ |  j d  k r d t j j |  d f |  _ t j j t |  j d  |  _ n t j j t |  j  |  _ PqqW|  j   d  S(   NRJ  s   ..t   sourcet   imagess   icon-windowed.icnsR~   i    R   s   0.0.0s   unsupported entry %sR9  s   Mac%ss   .app(    R   R   R   R   R8   R   R   RJ  R   R6   R   R~   RB   R   t   appnameR   RQ   RD   R   RH  R:   RH   R   R   Ro  R?   RU   R   R   t   exenameR   R   (   R   R   RQ  RR  RR   R~   RH   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6     s8    !+.	 "RD   c         C   s   d S(   Ni   (    (   R   R[   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s    c         C   s  t  |  j  r4 t j j |  j  r4 t |  j  n  t j d t j j |  j	   t j
 t j j |  j d d   t j
 t j j |  j d d   t j
 t j j |  j d d   t j j |  j  r t j |  j t j j |  j d d   n t j d |  j  i |  j d 6|  j d 6d	 t j j |  j  d
 6t j j |  j  d 6d d 6d d 6|  j d 6d d 6} d } x. | j   D]  \ } } | d | | f 7} qW| d 7} t t j j |  j d d  d  } | j |  | j   t |  j  } x | D] \ } } }	 |	 d k r8t | d | } n  t j j |  j d d |  }
 t j j |
  } t j j |  st j
 |  n  t j | |
  qWt j j |  j d d d  } t j j |  j d d d  } t j j |  rt j | |  n  d S(   Ns   building BUNDLE %st   Contentst   MacOSt	   Resourcest
   Frameworkss   icon not found %st   CFBundleDisplayNamet   CFBundleNames   MacOS/%st   CFBundleExecutablet   CFBundleIconFiles   6.0t   CFBundleInfoDictionaryVersiont   APPLt   CFBundlePackageTypet   CFBundleShortVersionStringt   1t   LSBackgroundOnlys   <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>s"   <key>%s</key>
<string>%s</string>
s   </dict>
</plist>s
   Info.plistR   RO   R   R  s   qt_menu.nibi   (   s	   EXTENSIONs   BINARY(   Re   R~   R   R   Rr  Rq   R?   RU   R   R   R   R8   R   RJ  Rn   Rc  R   Rx  Ry  R   R   R   R   R   RT   RD   R  R   R  t   copytree(   R   t   info_plist_dictt
   info_plistt   kt   vR*   RD   RR   R-   RH   Rs  Rt  t   qt_menu_dirt   qt_menu_dest(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     sN    $"""+


$
(   R   R   R6   R\   R   R   R   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyRu    s   	(	RQ   c           B   s\   e  Z d	 d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z RS(
   c         C   sD   t  j  j |   i  |  _ | r@ x | D] } |  j |  q& Wn  d  S(   N(   t   UserListR6   t   fltrR:   (   R   t   initlistt   tpl(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6   5  s
    	c         C   s   ye | d } | d d k r2 t  j j |  } n  |  j j |  sd |  j j |  d |  j | <n  Wn$ t k
 r t j	 d |    n Xd  S(   Ni    i   R   i   s   TOC found a %s, not a tuple(
   R   R   R
  R  R   R   R:   t	   TypeErrorR?   RU   (   R   R  t   fn(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR:   <  s    
c         C   sh   | d } | d d k r/ t  j j |  } n  |  j j |  sd |  j j | |  d |  j | <n  d  S(   Ni    i   R   i   (   R   R   R
  R  R   R   R   (   R   t   posR  R  (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR   L  s    
c         C   s    t  |  j  } | j |  | S(   N(   RQ   R   R   (   R   t   otherR   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   __add__T  s    c         C   s    t  |  } | j |  j  | S(   N(   RQ   R   R   (   R   R  R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   __radd__Y  s    c         C   s"   x | D] } |  j  |  q Wd  S(   N(   R:   (   R   R  R  (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR   ^  s    c         C   s   |  j  j   } x2 | D]* } | j | d d  r | | d =q q Wt   } x7 |  j D], } | j | d d  rW | j |  qW qW W| S(   Ni    (   R  Rc  R   RQ   R   R:   (   R   R  t   fdR  R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   __sub__b  s    	c         C   s   t  |  } | j |   S(   N(   RQ   R  (   R   R  R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   __rsub__o  s    c         C   sG   t    } x7 | D]/ } |  j j | d d  r | j |  q q W| S(   Ni    (   RQ   R  R   R:   (   R   R  R   R  (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt	   intersects  s
    	N(   R   R   R   R6   R:   R   R  R  R   R  R  R  (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyRQ   4  s   							t   Treec           B   sP   e  Z d d d d   Z d e f d e f d e f d f Z d   Z d   Z RS(	   c         C   s[   t  j |   t j |   | |  _ | |  _ | |  _ | d  k rM g  |  _ n  |  j   d  S(   N(   R   R6   RQ   t   rootR   R   R   R   (   R   R  R   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6   |  s    			R  R   R   RD   c         C   s   t  j |  |  } | s t S| d g } | d } x | r | j   } t |  | k rt t j d |  j |  t SxN t j	 |  D]= } t j
 j | |  } t j
 j |  r | j |  q q Wq6 W| |  _ t S(   Ni    i   s(   building %s because directory %s changed(   R   R   RV   t   popR.   R?   RU   R   R   t   listdirR   R8   Rr  R:   R   RW   (   R   R[   R   t   stackRD   R   RG   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s"    
			c         C   s  t  j d t j j |  j   |  j |  j f g } i  } i  } x< |  j D]1 } | d d k rq d | | d <qJ d | | <qJ Wg  } x | r}| j	   \ } } x t j
 |  D] } | j | d  d k r t j j |  d }	 | j |	 d  d k rvt j j | |  }
 | r,t j j | |  p/| } t j j |
  rZ| j |
 | f  qs| j | |
 d f  qvq q Wq W| |  _ y t |  j  } Wn d  } n X|  j |  j |  j |  j f } | | k rt |  j |  d St  j d |  j  d S(   Ns   building Tree %si    RZ  i   R7  s   %s no change!(   R?   RU   R   R   R   R   R  R   R   R  R  R   RB   R8   Rr  R:   R   R%   R   R!   (   R   R  R   t	   xexcludesRG   R   t   dirR   R-   RK   t   fullfnmt   rfnmR   R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s>    	!$	
N(   s   tocN(   R   R   R   R6   R\   R   R   R   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR  {  s   
					t   MERGEc           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s   
    Merge repeated dependencies from other executables into the first
    execuable. Data and binary files are then present only once and some
    disk space is thus reduced.
    c         G   s   d |  _ i  |  _ i  |  _ x$ | D] \ } } } | |  j | <q" Wt j j t j j g  | D], \ } } } t j j | j	 d d  ^ q[   |  _
 |  j
 d t j k r |  j
 t j 7_
 n  t j d |  j
  |  j |  d S(   s|  
        Repeated dependencies are then present only once in the first
        executable in the 'args' list. Other executables depend on the
        first one. Other executables have to extract necessary files
        from the first executable.

        args  dependencies in a list of (Analysis, id, filename) tuples.
              Replace id with the correct filename.
        ii   s   Common prefix: %sN(   R   t   _maint   _dependenciest   _id_to_pathR   R   R   t   commonprefixR/   R   t   _common_prefixRu   R?   RU   t   _merge_dependencies(   R   R   t   _R}   t   pR5  (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR6     s    			Tc         C   s   x | D] \ } } } t  j j | j d d  j |  j d d  } t  j j |  d } | |  j k rz |  j | } n  |  j | |  q Wd S(   sL   
        Filter shared dependencies to be only in first executable.
        ii   R   i    N(	   R   R   R/   R   Rt   R  RB   R  t   _set_dependencies(   R   R   t   analysisR  R   (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR    s    /c         C   s!  x| j  | j f D]} x t |  D] \ } } | d |  j j   k rz t j d | d | f  | |  j | d <q& |  j | |  j | d  } t j d | d | | f  | j j	 d j
 | | d f  | d d f  d | | <q& Wg  | D] } | d	 k r | ^ q | (q Wd S(
   sN   
        Syncronize the Analysis result with the needed dependencies.
        i   s"   Adding dependency %s located in %ss6   Referencing %s to be a dependecy for %s, located in %sR	  i    RP   N(   NNN(   NNN(   R   R   R   R  R   R?   R@   t   _get_relative_pathR   R:   R8   R   (   R   R  R   RD   R}   R  t   dep_path(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR    s    0c         C   sT   | j  t j  d  } d g t |  } | rL | j |  t j j |  S| Sd  S(   Nis   ..(   RC   R   Ru   Rx   R:   R8   (   R   t	   startpatht   topatht   start(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR    s    (   R   R   t   __doc__R6   R  R  R  (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR    s
   			c           C   s   t  d   d  S(   Ns   TkTree has been removed in PyInstaller 2.0. Please update your spec-file. See http://www.pyinstaller.org/wiki/MigrateTo2.0 for details(   Rb   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   TkTree  s    c           C   s   t  d   d  S(   Ns   TkPKG has been removed in PyInstaller 2.0. Please update your spec-file. See http://www.pyinstaller.org/wiki/MigrateTo2.0 for details(   Rb   (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   TkPKG  s    c         C   s  t  t j j t d d   a |  a t j j |   \ a a	 t j j
 t	  d a	 t d k rm t j   a n  t j j t d d t j t	  a | t k r | } t j j |  r | a q t j j t |  a n  t j j t d t	  a t j j t  st j t  n  t |   d  S(   NR   s   rthooks.dati    R   R   s   pyi.s
   warn%s.txt(   R%   R   R   R8   R   R   Rc   RC   R   R   RB   R   Rh   t   platformR9   t   DEFAULT_BUILDPATHR   R   R   R   t   execfile(   t   spect	   buildpatht   bpath(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyR     s"    	c         C   s   |  j  d d t d d |  j  d d d d d t d d	 t j j d
 d d  |  j  d d d  d d |  j  d d d d d d d  S(   Ns   --buildpatht   defaultt   helps   Buildpath (default: %default)s   -ys   --noconfirmt   actiont
   store_trues:   Remove output directory (default: %s) without confirmationR   t   distR   s	   --upx-dirs2   Directory containing UPX (default: search in path)s   -as   --asciisA   do NOT include unicode encodings (default: included if available)(   t
   add_optionR  RW   R   R   R8   R   (   t   parser(    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   __add_options1  s    c         K   s   | a  | s" t j t j    n  d d  l j } | j | j d   a	 t	 d r d d l
 m a m a m a t j t j  a n d  a t	 d r t   n  t	 d s d t _ n  t |  |  d  S(   NiR  RT  (   RJ  R^  R  R  t	   useELFEXEi    (   Rg   R   R   R   t   get_unicode_modulest   PyInstaller.configuret	   configuret
   get_configR   R   t   PyInstaller.utilsRJ  R^  R  R   t   getAssembliesRh   R   R  R   R+   RH  RL  R   (   t   specfileR  t	   noconfirmt   asciit   kwR  (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   main?  s    



([   Rh   R   Rn   R   R=   R;   R[  R  R   t   PyInstaller.loaderR    R   t   PyInstaller.depend.imptrackerR   t   PyInstaller.depend.modulesR   R   R   R   R   R   R   R	   R
   R   t   PyInstaller.compatR'   R   R   t   PyInstaller.dependR   R  R   t   PyInstaller.logt   logt   loggingR   t	   getLoggerR?   t   typet
   STRINGTYPER   t	   TUPLETYPERw   t   UNCOMPRESSEDR?  R   R8   R  Rc   R   R9   R   Rg   R   R   R!   R%   R+   R.   R2   RN   RT   R\   R^   R_   Re   Rq   R   R   R   R   R   R  R  R@  R0  RH  Rl  Ro  Ru  RQ   R  t   objectR  R  R  R   R  RW   R  (    (    (    sB   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/build.pyt   <module>   s   (							?		
			- "	,	aAwGHJ				