ó
• –Qc           @   s	  d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z m	 Z	 d d l
 m Z d d l j Z e j d ƒ Z d e f d „  ƒ  YZ d	 d d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   s6  
An Owner does imports from a particular piece of turf
That is, there's an Owner for each thing on sys.path
There are owners for directories and .pyz files.
There could be owners for zip files, or even URLs.
Note that they replace the string in sys.path,
but str(sys.path[n]) should yield the original string.
iÿÿÿÿN(   t   depend(   t   getcwdt   PYCOt   caseOk(   t   pyi_archives   PyInstaller.build.mft
   OwnerErrorc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   "   s   t   Ownerc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sG   
    Base class for loading Python bytecode from different places.
    c         C   s   | |  _  d  S(   N(   t   path(   t   selfR	   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyt   __init__*   s    c         C   s   |  j  S(   N(   R	   (   R
   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyt   __str__-   s    c         C   s   d  S(   N(   t   None(   R
   t   nm(    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyt   getmod0   s    (   R   R   t   __doc__R   R   R   (    (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   &   s   		t   BaseDirOwnerc           B   s)   e  Z d  Z d „  Z d e j d „ Z RS(   sM   
    Base class for loading bytecode of Python modules from file system.
    c         C   s
   t  j ƒ  S(   N(   t   impt   get_suffixes(   R
   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyt   _getsuffixes8   s    c      	   C   sa  | d  k r |  j } n  | d d  f g } |  j | ƒ rs |  j | ƒ rs | j d t j j | d ƒ d | f ƒ n  d  } } xß | D]× \ } } }	 xµ | ƒ  D]ª \ }
 } } | |
 } |  j | ƒ } | d  k	 r |  j | ƒ sæ q n  | t	 j
 k rt j j | t j j |  j | ƒ ƒ S| t	 j k r8| | f } qG| | f } q q W| sW| r„ Pq„ q„ W| d  k r{| d  k r{d  Sd  } | r"|  j | d ƒ } | d  t	 j ƒ  k rÊt j d t | d ƒ q"y | | d ƒ } | d } Wq"t t f k
 rd  } t j d t | d ƒ q"Xn  | d  k sH| rÕ| d | d k  rÕy[ |  j | d ƒ d } t | j d	 d ƒ | d d
 ƒ } | d t } t j d | ƒ WqÕt k
 rÑ} t j | ƒ t d ƒ ‚ qÕXn  | d  k råd  St j j |  j | ƒ } t j j | ƒ s$t j j | ƒ } n  | rE|  j ƒ  | | | ƒ } n |  j ƒ  | | | ƒ } | S(   Ni    R   i   i   s,   wrong version .py%s found (%s), will use .pyi   s"   bad .py%s found (%s), will use .pys   
s   
t   execs   compiled %si
   (    R   R   t   _isdirt   _caseokt   insertt   osR	   t   joint   _modtimeR   t   C_EXTENSIONR    t   modulest   ExtensionModulet	   PY_SOURCEt   _readt	   get_magict   loggert   warnR   t
   ValueErrort   EOFErrort   compilet   replacet   debugt   SyntaxErrort	   exceptiont
   SystemExitt   isabst   abspatht	   _pkgclasst	   _modclass(   R
   R   t   getsuffixest   loadcot	   possiblest   pyt   pyct   ptht   ispkgt   pkgptht   extt   modet   typt   attemptt   modtimet   cot   stufft   et   mod(    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   ;   sj    +

%		&"N(   R   R   R   R   R   t   marshalt   loadsR   (    (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   4   s   	t   DirOwnerc           B   sG   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sW   | d k r t  ƒ  } n  t j j | ƒ sC t d t | ƒ ƒ ‚ n  t j |  | ƒ d  S(   Nt    s   %s is not a directory(   R   R   R	   t   isdirR   t   reprR   R   (   R
   R	   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   †   s
    c         C   s"   t  j j t  j j |  j | ƒ ƒ S(   N(   R   R	   RE   R   (   R
   t   fn(    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR      s    c         C   s@   y' t  j t  j j |  j | ƒ ƒ d SWn t k
 r; d  SXd  S(   Ni   (   R   t   statR	   R   t   OSErrorR   (   R
   RG   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR      s    'c         C   s%   t  t j j |  j | ƒ d ƒ j ƒ  S(   Nt   rb(   t   openR   R	   R   t   read(   R
   RG   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR    –   s    c         C   s
   t  j j S(   N(   R    R   t	   PkgModule(   R
   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR.   ™   s    c         C   s
   t  j j S(   N(   R    R   t   PyModule(   R
   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR/   œ   s    c         C   s   t  t j j |  j | ƒ ƒ S(   N(   R   R   R	   R   (   R
   RG   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   Ÿ   s    (	   R   R   R   R   R   R    R.   R/   R   (    (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyRC   „   s   						t   ZipOwnerc           B   sV   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   si  
    Load bytecode of Python modules from .egg files.

    zipimporter cannot be used here because it has a stupid bug:

      >>> z.find_module("setuptools.setuptools.setuptools.setuptools.setuptools") is not None
      True

    So mf will go into infinite recursion. Instead, we'll reuse
    the BaseDirOwner logic, simply changing the template methods.
    c         C   s]   d d  l  } y | j | d ƒ |  _ Wn! t k
 rH t d | ƒ ‚ n Xt j |  | ƒ d  S(   Niÿÿÿÿt   rs   %s is not a zipfile(   t   zipfilet   ZipFilet   zft   IOErrorR   R   R   (   R
   R	   RQ   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   ¯   s    c         C   s"   | j  d d ƒ } t j |  | ƒ S(   Nt   .t   /(   R'   R   R   (   R
   RG   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   ·   s    c         C   sH   | j  d d ƒ } y |  j j | ƒ j } | SWn t k
 rC d  SXd  S(   Ns   \RV   (   R'   RS   t   getinfot	   date_timet   KeyErrorR   (   R
   RG   t   dt(    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   »   s    c         C   s   t  S(   N(   t   True(   R
   RG   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   Ä   s    c         C   s   t  S(   N(   R[   (   R
   RG   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   É   s    c         C   s"   | j  d d ƒ } |  j j | ƒ S(   Ns   \RV   (   R'   RS   RL   (   R
   RG   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR    Î   s    c            s   ‡  f d †  S(   Nc             s   t  j j ˆ  |  Œ S(   N(   R    R   t   PkgInZipModule(   t   args(   R
   (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyt   <lambda>Ô   s    (    (   R
   (    (   R
   s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR.   Ó   s    c            s   ‡  f d †  S(   Nc             s   t  j j ˆ  |  Œ S(   N(   R    R   t   PyInZipModule(   R]   (   R
   (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR^   ×   s    (    (   R
   (    (   R
   s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR/   Ö   s    (   R   R   R   R   R   R   R   R   R    R.   R/   (    (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyRO   £   s   								t   PYZOwnerc           B   s    e  Z d  Z d „  Z d „  Z RS(   s£  
    Class for loading bytecode of Python modules from PYZ files.

    PYZ file is internal PyInstaller format embedded into final executable.

    It is possible to have a custom .spec file which packs a subset of Python
    files into a PYZ file, and then drop it on the disk somewhere. When the PYZ
    file is added to sys.path, PYZOwner will parse it and make the modules
    within it available at import time.

    NOTE: PYZ format cannot be replaced by zipimport module.

    The problem is that we have no control over zipimport; for instance,
    it doesn't work if the zip file is embedded into a PKG appended
    to an executable, like we create in one-file.
    c         C   s&   t  j | ƒ |  _ t j |  | ƒ d  S(   N(   R   t   ZlibArchivet   pyzR   R   (   R
   R	   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   ë   s    c         C   s]   |  j  j | ƒ } | s d  S| \ } } | rD t j j | | |  ƒ St j j | |  j | ƒ S(   N(   Rb   t   extractR   R    R   t   PkgInPYZModuleRN   R	   (   R
   R   t   rsltR6   R=   (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR   ï   s    (   R   R   R   R   R   (    (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyR`   Ú   s   	(    (   R   R   RA   R   t   PyInstallerR    t   PyInstaller.compatR   R   R   t   PyInstaller.loaderR   t   PyInstaller.logt   logt   loggingt	   getLoggerR"   t	   ExceptionR   R   R   RC   RO   R`   (    (    (    s[   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\depend\owner.pyt   <module>   s   P7