
 Qc           @   s   d  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
 m Z m Z d d l j Z d d l
 j Z d d l j Z d d l Z d d l Z e j e  Z d   Z d   Z d   Z d   Z d S(	   s<   
Configure PyInstaller for the current Python installation.
iN(   t   HOMEPATHt   PLATFORM(   t   is_wint	   is_darwinc         C   sL  d |  d <t  s d  St j d  y& d d  l } d d l m } m } Wn$ t k
 rm } t j d |  d  SXt j	 j
 t d d t d	  } t j	 j |  s d |  d <t j d
 |  d  St j	 j
 t j   d  } t j | |  y | j | d  } Wn t j d  n( X| j | d  d |  d <t j d  t j |  d  S(   Ni    t   hasRsrcUpdates6   Testing for ability to set icons, version resources...i(   t   icont   versioninfos$   ... resource update unavailable - %st   PyInstallert
   bootloaders   runw.exes.   ... resource update unavailable - %s not founds   me_test_exe.tmpsE   ... resource update unavailable - win32api.BeginUpdateResource failedi   s   ... resource update available(   R   t   loggert   infot   win32apit   PyInstaller.utilsR   R   t   ImportErrort   ost   patht   joinR    R   t   existst   errort   tempfilet
   gettempdirt   shutilt   copyfilet   BeginUpdateResourcet   EndUpdateResourcet   remove(   t   configR   R   R   t   detailt   test_exet   rw_test_exet   hexe(    (    sX   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\configure.pyt   test_RsrcUpdate$   s2    


c         C   sY  t  j d  d } | r= t j j t j j | |   } n  d } y t j | d  j   j	   } | r | d j
   d } t t t | j
 d    } t r | d k  r t  j d  d } q n  WnQ t k
 r} t | t  r | j d	 k r qt  j d
  t  j d |  n X| r+d } n d } t  j d |  | |  d <| |  d <d  S(   Ns   Testing for UPX ...t   upxi    s   -Vi   t   .i\   s;   UPX is too old! Python 2.4 under Windows requires UPX 1.92+i   s*   An exception occured when testing for UPX:s     %rt	   availables   not availables
   UPX is %s.t   hasUPXt   upx_dir(   i   i\   (   R	   t   debugR   R   t   normpathR   t   compatt   exec_commandt   stript
   splitlinest   splitt   tuplet   mapt   intR   R   t	   Exceptiont
   isinstancet   OSErrort   errnoR
   (   R   R$   t   cmdR#   t   verst   vt   et   is_available(    (    sX   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\configure.pyt   test_UPXF   s0    $	
c         C   s  t  j d  d d  l } | j j j t j j t	 j
 | j   t j j t d  g  } | j d  | j d } t j | j | j d f g  } x t |  D] \ } \ } } } | j | } g  }	 x | j D] \ }
 } } } | s | j |
 |  } xX | D]M } | j | } t | | j j j  s|	 j | j | j | j f  qqWq q W| j |	  q W| j   | j |  d <d  S(   Ns   Computing PYZ dependenciesit   supportt   pyi_importerst   PYMODULEt   PYZ_dependencies(   R	   R%   t   PyInstaller.loadert   dependt
   imptrackert   ImportTrackerR   R   t   dirnamet   inspectt   getsourcefilet   loaderR   R    t	   analyze_rt   modulest   buildt   TOCt   __name__t   __file__t	   enumeratet   importst   analyze_oneR0   t   BuiltinModulet   appendt   typt   extendt   reverset   data(   R   R   t   at   modt   toct   it   nmt   fnmRP   t   tmpt
   importednmt	   isdelayedt   isconditionalt   levelt   realnmst   realnmt   imported(    (    sX   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\configure.pyt   find_PYZ_dependenciesg   s*    !"-
c         K   sg   t  r< t j   d k r< t j d t j  t j d  n  i  } t	 |  t
 | |   t |  | S(   Nt   64bits   You are running 64-bit Python: created binaries will only work on Mac OS X 10.6+.
If you need 10.4-10.5 compatibility, run Python as a 32-bit binary with this command:

    VERSIONER_PYTHON_PREFER_32_BIT=yes arch -i386 %s
i   (   R   R'   t   architectureR	   t   warnt   syst
   executablet   timet   sleepR   R8   Rb   (   R$   t   kwR   (    (    sX   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\configure.pyt
   get_config   s    	

(   t   __doc__RB   R   R   Rf   R   Rh   R   R    R   t   PyInstaller.compatR   R   t   PyInstaller.buildRG   R'   t   PyInstaller.logt   logt   loggingt   PyInstaller.depend.modulest   PyInstaller.depend.imptrackert	   getLoggerRI   R	   R   R8   Rb   Rk   (    (    (    sX   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\configure.pyt   <module>   s$   	"	!	