
 Qc           @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z e j d4 k Z e j d5 k Z e j d6 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 Z y d d l Z Wn e k
 rd Z n Xd e j k r2d   Z n	 d   Z d d d d d d d d d d g
 Z e rkd pnd Z y d d l Z Wn' e k
 rd e f d     YZ 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%   Z% d d&  Z& d'   Z' d(   Z( d)   Z) d*   Z* d+   Z+ d,   Z, d-   Z- d.   Z. d/   Z/ d0   Z0 d1   Z1 d2   Z2 d3   Z3 d S(7   sy   
Various classes and functions to provide some backwards-compatibility
with previous versions of Python from 2.3 onward.
iNi   i   i   i   t   wint   cygwint   darwint   linuxt   sunt   aixt   ct   PYTHONCASEOKc         C   s1   t  j t j j |    } t j j |   | k S(   N(   t   dircachet   listdirt   ost   patht   dirnamet   basename(   t   filenamet   files(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyt   caseOk;   s    c         C   s   t  S(   N(   t   True(   R   (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyR   ?   s    s   --upxs   -Xs   -Ks   --tks   -Cs   --configfiles   --skip-configures   -os   --outs   --buildpaths   -Ot    t   hashlibc           B   s(   e  Z d  d l m Z d  d l m Z RS(   i(   t   new(   t   __name__t
   __module__t   md5R   t   sha(    (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyR   V   s   t   relpath(   R   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(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyR   `   s    t   real_prefixc           C   s2   t  r  t j d k r d Sd Sn t 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.
    l    i    t   64bitt   32biti    Nl        (   t	   is_darwint   syst   maxintt   platformt   architecture(    (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyR(   r   s
    c          C   s    t  j   }  |  d k r d S|  S(   Nt	   Microsoftt   Windows(   R'   t   system(   t   syst(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyR+      s    c          C   s'   t  j   }  |  j d  r d Sd Sd S(   s[  
    Return machine suffix to use in directory name when looking
    for bootloader.

    PyInstaller is reported to work even on ARM architecture. For that
    case functions system() and architecture() are not enough. 
    Path to bootloader has to be composed from system(), architecture()
    and machine() like:
        'Linux-32bit-arm'
    t   armN(   R'   t   machinet
   startswitht   None(   t   mach(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyR.      s    c         C   s   t  j j |  |  S(   sQ   
    Returns unicode string containing value of environment variable 'name'.
    (   R
   t   environt   get(   t   namet   default(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\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
   R2   (   R4   t   value(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyt   setenv   s    c         C   s   d t  j |  <t  j |  =d S(   s1   
    Delete the environment variable 'name'.
    R   N(   R
   R2   (   R4   (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\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(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\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()`
    (   R;   t   call(   R?   t   kwargs(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\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   bufsizeiR:   t   stderr(   R;   R<   R=   R>   t
   returncode(   R?   RB   t   proct   outt   err(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\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
   executableR$   R(   t   _PYOPTSt   appendt   extend(   t   argsRB   R?   t   mappingt	   py_prefix(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\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.
    (   RS   R@   (   RP   RB   R?   (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\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.
    (   RS   RC   (   RP   RB   R?   (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\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.
    (   RS   RJ   (   RP   RB   R?   (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyt   exec_python_all  s    c          C   sn   t  j   }  t rj y t |   Wqj t k
 rf y d d l } | j |   }  Wqg t k
 rb qg Xqj Xn  |  S(   sv   
    Wrap os.getcwd()

    On Windows return ShortPathName (8.3 filename) that contain only ascii
    characters.
    iN(   R
   t   getcwdt   is_wint   unicodet   UnicodeDecodeErrort   win32apit   GetShortPathNamet   ImportError(   t   cwdR[   (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyRW     s    c         C   s   t  j j t  j j |    S(   s   
    Replace initial tilde '~' in path with user's home directory and also
    expand environment variables (${VARNAME} - Unix, %VARNAME% - Windows).
    (   R
   R   t
   expandvarst
   expanduser(   R   (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyt   expand_path2  s    c         C   s   | j  d |  d  S(   Ns,   %s option does not exist anymore (obsolete).(   t   error(   t   optiont   optR7   t   parser(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyt   __obsolete_option=  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_OPTIONSRf   (   Re   t   g(    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyt   __add_obsolete_optionsA  s
    	
(   i   i   (   i   i   (   i   i   (4   t   __doc__R   R
   R'   R;   R%   t   version_infot   is_py25t   is_py26t   is_py27R/   RX   t	   is_cygwinR$   t   is_linuxt   is_solart   is_aixt   is_unixt   PYCOt   ctypesR]   R0   R2   R   Rl   t	   __debug__RM   R   t   objectt   hasattrR   t   os.pathR   t   curdirt   is_virtualenvR(   R+   R.   R6   R8   R9   R@   RC   RJ   RS   RT   RU   RV   RW   Ra   Rf   Rn   (    (    (    sU   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\compat.pyt   <module>   sn   
				
				
	
			
	
				