ķ
%}Xc           @   sq   d  d l  Z  d  d l m Z d  d l Z d  d l m Z e j j Z d d d     YZ	 d e	 f d     YZ
 d S(	   i˙˙˙˙N(   t   log(   t   mapt	   Installerc        	   B   s_   e  Z d  Z d   Z d   Z d   Z d Z d Z d   Z d   Z	 d   Z
 e d    Z RS(   s
   -nspkg.pthc         C   sŗ   |  j    } | s d  St j j |  j    \ } } | |  j 7} |  j j |  t j	 d |  t
 |  j |  } |  j r t |  d  St | d   } | j |  Wd  QXd  S(   Ns   Installing %st   wt(   t   _get_all_ns_packagest   ost   patht   splitextt   _get_targett	   nspkg_extt   outputst   appendR    t   infoR   t   _gen_nspkg_linet   dry_runt   listt   opent
   writelines(   t   selft   nspt   filenamet   extt   linest   f(    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyt   install_namespaces   s    	
c         C   sb   t  j j |  j    \ } } | |  j 7} t  j j |  sA d  St j d |  t  j |  d  S(   Ns   Removing %s(	   R   R   R   R   R	   t   existsR    R   t   remove(   R   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyt   uninstall_namespaces!   s    c         C   s   |  j  S(   N(   t   target(   R   (    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyR   )   s    s   import sys, types, oss#   has_mfs = sys.version_info > (3, 5)s$   p = os.path.join(%(root)s, *%(pth)r)s4   importlib = has_mfs and __import__('importlib.util')s-   has_mfs and __import__('importlib.machinery')s   m = has_mfs and sys.modules.setdefault(%(pkg)r, importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec(%(pkg)r, [os.path.dirname(p)])))sS   m = m or not has_mfs and sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))s7   mp = (m or []) and m.__dict__.setdefault('__path__',[])s   (p not in mp) and mp.append(p)s4   m and setattr(sys.modules[%(parent)r], %(child)r, m)c         C   s   d S(   Ns$   sys._getframe(1).f_locals['sitedir'](    (   R   (    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyt	   _get_rootC   s    c         C   s|   t  |  } t | j d   } |  j   } |  j } | j d  \ } } } | rd | |  j 7} n  d j |  t   d S(   Nt   .t   ;s   
(	   t   strt   tuplet   splitR   t   _nspkg_tmplt
   rpartitiont   _nspkg_tmpl_multit   joint   locals(   R   t   pkgt   ptht   roott
   tmpl_linest   parentt   sept   child(    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyR   F   s    	c         C   s.   |  j  j p g  } t t t |  j |    S(   s,   Return sorted list of all package namespaces(   t   distributiont   namespace_packagest   sortedt   flattenR   t
   _pkg_names(   R   t   pkgs(    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyR   Q   s    c         c   s8   |  j  d  } x" | r3 d j |  V| j   q Wd S(   sĪ   
        Given a namespace package, yield the components of that
        package.

        >>> names = Installer._pkg_names('a.b.c')
        >>> set(names) == set(['a', 'a.b', 'a.b.c'])
        True
        R   N(   R"   R&   t   pop(   R(   t   parts(    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyR3   V   s    
	(	   s   import sys, types, oss#   has_mfs = sys.version_info > (3, 5)s$   p = os.path.join(%(root)s, *%(pth)r)s4   importlib = has_mfs and __import__('importlib.util')s-   has_mfs and __import__('importlib.machinery')s   m = has_mfs and sys.modules.setdefault(%(pkg)r, importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec(%(pkg)r, [os.path.dirname(p)])))sS   m = m or not has_mfs and sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))s7   mp = (m or []) and m.__dict__.setdefault('__path__',[])s   (p not in mp) and mp.append(p)(   s4   m and setattr(sys.modules[%(parent)r], %(child)r, m)(   t   __name__t
   __module__R	   R   R   R   R#   R%   R   R   R   t   staticmethodR3   (    (    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyR      s$   			        			t   DevelopInstallerc           B   s   e  Z d    Z d   Z RS(   c         C   s   t  t |  j   S(   N(   t   reprR    t   egg_path(   R   (    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyR   g   s    c         C   s   |  j  S(   N(   t   egg_link(   R   (    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyR   j   s    (   R7   R8   R   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyR:   f   s   	(    (   R   t	   distutilsR    t	   itertoolst   setuptools.extern.six.movesR   t   chaint   from_iterableR2   R   R:   (    (    (    s9   /usr/lib/python2.7/dist-packages/setuptools/namespaces.pyt   <module>   s   [