ó
Šś"Pc        	   @   s-  d  d l  Z  d  d l Z d  d l Z y d  d l Z Wn# e k
 rY d  d l j j Z n Xe j d6 k Z	 e j d7 k Z
 e j d8 k Z e j d9 k Z e j d: k Z e j j d  Z e j d	 k Z e j d
 k Z e j j d  Z e j j d  Z e j j d  Z e pe pe Z d  d l Z d e j f d     YZ d Z e e d  rce j Z n e rrd Z n d Z y d  d l Z Wn e k
 rĄd Z n Xd e j k r˝d   Z n	 d   Z d d d d d d d g Z  e! ríd pđd Z" y d  d l# Z# Wn' e k
 r,d  e$ f d!     YZ# n Xy d  d" l% m& Z& Wn! e k
 rdd  d# l' m( Z& n Xe e j) d$  rd  d% l* m+ Z+ n e j, d&  Z+ e e d'  Z- d(   Z. d)   Z/ d d*  Z0 d+   Z1 d,   Z2 d-   Z3 d.   Z4 d/   Z5 d0   Z6 d1   Z7 d2   Z8 d3   Z9 d4   Z: d5   Z; d S(;   i˙˙˙˙Ni   i   i   i   i   i   t   wint   cygwint   darwint   linuxt   sunt   aixt   LogDictc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   i    c         G   s   t  j  j |  |  t j d 7_ d d j t t t j   t j f } t	 j
 j d  rt t	 j
 j d |  } n  t | d  |  _ d  S(   Ni   s   logdict%s-%d.logt   .t   buildt   w(   t   UserDictt   __init__R   t   countt   joint   mapt   strt   syst   version_infot   ost   patht   isdirt   opent   logfile(   t   selft   argsR   (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyR   >   s    c         C   sC   |  j  j d | |  j j |  | f  t j j |  | |  d  S(   Ns   %s: %s -> %s
(   R   t   writet   datat   getR
   t   __setitem__(   R   t   keyt   value(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyR   G   s    )c         C   s+   |  j  j d |  t j j |  |  d  S(   Ns	     DEL %s
(   R   R   R
   t   __delitem__(   R   R   (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyR   K   s    (   t   __name__t
   __module__R   R   R   R   (    (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyR   ;   s   			t   ct   devnullt   nuls	   /dev/nullt   PYTHONCASEOKc         C   s1   t  j t j j |    } t j j |   | k S(   N(   t   dircachet   listdirR   R   t   dirnamet   basename(   t   filenamet   files(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   caseOkk   s    c         C   s   t  S(   N(   t   True(   R*   (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyR,   o   s    s   --upxs   -Xs   -Ks   --tks   -Cs   --configfiles   --skip-configures   -Ot    t   hashlibc           B   s(   e  Z d  d l m Z d  d l m Z RS(   i˙˙˙˙(   t   new(   R    R!   t   md5R0   t   sha(    (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyR/      s   (   t   set(   t   Sett   relpath(   R5   c         C   s]   |  s t  d   n  t j j |   }  t j j |  t j } |  t |  t |   !} | S(   s6   
        Return a relative version of a path.
        s   no path specified(   t
   ValueErrorR   R   t   normpatht   abspatht   sept   len(   R   t   startt   relative(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyR5      s    t   real_prefixc          C   s>   d d l  }  t r, t j d k r% d Sd Sn |  j   d Sd S(	   sĆ   
    Returns the bit depth of the python interpreter's architecture as
    a string ('32bit' or '64bit'). Similar to platform.architecture(),
    but with fixes for universal binaries on MacOS.
    i˙˙˙˙Nl    i    t   64bitt   32biti    l        (   t   platformt	   is_darwinR   t   maxintt   architecture(   R@   (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyRC   ¨   s    c          C   s,   d d  l  }  |  j   } | d k r( d S| S(   Ni˙˙˙˙t	   Microsoftt   Windows(   R@   t   system(   R@   t   syst(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyRF   ź   s
    c         C   s   t  j j |  |  S(   sQ   
    Returns unicode string containing value of environment variable 'name'.
    (   R   t   environR   (   t   namet   default(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   getenvĎ   s    c         C   s   | t  j |  <d S(   sh   
    Accepts unicode string and set it as environment variable 'name' containing
    value 'value'.
    N(   R   RH   (   RI   R   (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   setenvÖ   s    c         C   s   d t  j |  <t  j |  =d S(   s1   
    Delete the environment variable 'name'.
    R.   N(   R   RH   (   RI   (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   unsetenvŢ   s    c          G   s    t  j |  d t  j j   d S(   s   
    Wrap creating subprocesses

    Return stdout of the invoked command.
    Todo: Use module `subprocess` if available, else `os.system()`
    t   stdouti    (   t
   subprocesst   Popent   PIPEt   communicate(   t   cmdargs(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   exec_commandě   s    c          O   s   t  j |  |  S(   s   
    Wrap creating subprocesses.

    Return exit code of the invoked command.
    Todo: Use module `subprocess` if available, else `os.system()`
    (   RO   t   call(   RS   t   kwargs(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   exec_command_rcö   s    c       	   O   sL   t  j |  d d d t  j d t  j | } | j   \ } } | j | | f S(   sj   
    Wrap creating subprocesses

    Return tuple (exit_code, stdout, stderr) of the invoked command.
    t   bufsizei˙˙˙˙RN   t   stderr(   RO   RP   RQ   RR   t
   returncode(   RS   RV   t   proct   outt   err(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   exec_command_all   s    c         C   ss   t  j g } t rF i d d 6d d 6} d | t   g } | | } n  t r\ | j t  n  | j |   | | f S(   Ns   -i386R?   s   -x86_64R>   t   arch(   R   t
   executableRA   RC   t   _PYOPTSt   appendt   extend(   R   RV   RS   t   mappingt	   py_prefix(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   __wrap_python  s    c          O   s"   t  |  |  \ } } t | |   S(   s`   
    Wrap running python script in a subprocess.

    Return stdout of the invoked command.
    (   Rf   RT   (   R   RV   RS   (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   exec_python!  s    c          O   s"   t  |  |  \ } } t | |   S(   sc   
    Wrap running python script in a subprocess.

    Return exit code of the invoked command.
    (   Rf   RW   (   R   RV   RS   (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   exec_python_rc+  s    c          O   s"   t  |  |  \ } } t | |   S(   s{   
    Wrap running python script in a subprocess.

    Return tuple (exit_code, stdout, stderr) of the invoked command.
    (   Rf   R^   (   R   RV   RS   (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   exec_python_all5  s    c         C   s   | j  d |  d  S(   Ns,   %s option does not exist anymore (obsolete).(   t   error(   t   optiont   optR   t   parser(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   __obsolete_optionB  s    c         C   s8   |  j  d  } | j t i d d 6t d 6d d 6  d S(   sq   
    Add the obsolete options to a option-parser instance and
    print error message when they are present.
    s#   Obsolete options (not used anymore)t   callbackt   actions#   These options do not exist anymore.t   helpN(   t   add_option_groupt
   add_optiont   _OLD_OPTIONSRn   (   Rm   t   g(    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   __add_obsolete_optionsF  s
    	
(   i   i   (   i   i   (   i   i   (   i   i   (   i   i   (<   R&   R   R   RO   t   ImportErrort   PyInstaller.lib.__subprocesst   libt   __subprocessR   t   is_py23t   is_py24t   is_py25t   is_py26t   is_py27R@   t
   startswitht   is_wint	   is_cygwinRA   t   is_linuxt   is_solart   is_aixt   is_unixR
   R   t   PYCOt   hasattrR#   t   ctypest   NoneRH   R,   Rt   t	   __debug__Ra   R/   t   objectt   __builtin__R3   t   setsR4   R   t   os.pathR5   t   curdirt   is_virtualenvRC   RF   RK   RL   RM   RT   RW   R^   Rf   Rg   Rh   Ri   Rn   Rv   (    (    (    sC   /home/salopaasi/Documents/Moo/pyinstaller-2.0/PyInstaller/compat.pyt   <module>   s   	
							
	
			
	
		