ó
æNXc           @   sÔ   d  Z  d d l Z d d l Z d d l Z d d l m Z d d l Z d d l m	 Z	 d d l
 m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z d „  Z d „  Z d	 „  Z d
 „  Z d d „ Z d S(   s/   Find files and directories which IPython uses.
iÿÿÿÿN(   t   warn(   t   import_item(   t   get_home_dirt   get_xdg_dirt   get_xdg_cache_dirt   compress_usert   _writable_dirt   ensure_dir_existst   fs_encodingt   filefind(   t	   py3compatc    	      C   s  t  j }  t  j j } d } t ƒ  } t ƒ  } d |  k rF t d ƒ n  |  j d |  j d d ƒ ƒ } | d k rO| | | ƒ } | rO| | d ƒ } t	 | ƒ rLt
 } t  j j | ƒ rÝ t d j | | ƒ | | ƒ ƒ ƒ qIt  j j | ƒ rt d j | | ƒ | | ƒ ƒ ƒ qIt d j | | ƒ | | ƒ ƒ ƒ t j | | ƒ qLqOn  t  j j t  j j | ƒ ƒ } t  j j | ƒ r®t	 | ƒ r®t d	 j | ƒ ƒ t j ƒ  } nU t  j j | ƒ st  j j | ƒ } t	 | ƒ st d
 j | ƒ ƒ t j ƒ  } qn  t j | t ƒ S(   s³   Get the IPython directory for this platform and user.

    This uses the logic in `get_home_dir` to find the home directory
    and then adds .ipython to the end of the path.
    s   .ipythont   IPYTHON_DIRsR   The environment variable IPYTHON_DIR is deprecated. Please use IPYTHONDIR instead.t
   IPYTHONDIRt   ipythonsD   Ignoring {0} in favour of {1}. Remove {0} to get rid of this messages>   {0} is deprecated. Move link to {1} to get rid of this messages   Moving {0} to {1}sE   IPython dir '{0}' is not a writable location, using a temp directory.sH   IPython parent '{0}' is not a writable location, using a temp directory.N(   t   ost   environt   patht   joinR   R   R    t   gett   NoneR   R   t   existst   formatt   islinkt   shutilt   movet   normpatht
   expandusert   tempfilet   mkdtempt   dirnameR
   t   cast_unicodeR   (	   t   envt   pjoint	   ipdir_deft   home_dirt   xdg_dirt   ipdirt	   xdg_ipdirt   cut   parent(    (    sE   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/paths.pyt   get_ipython_dir   sD    					"	
	
c          C   s€   t  ƒ  }  |  d k r t ƒ  St j j |  d ƒ } t j j | ƒ r] t |  ƒ r] t | ƒ n t |  ƒ sp t ƒ  St	 j
 | t ƒ S(   s;   Get the cache directory it is created if it does not exist.R   N(   R   R   R(   R   R   R   R   R   R   R
   R   R   (   t   xdgdirR$   (    (    sE   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/paths.pyt   get_ipython_cache_dirK   s    	c          C   s%   t  j j t j ƒ }  t j |  t ƒ S(   s9   Get the base directory where IPython itself is installed.(   R   R   R   t   IPythont   __file__R
   R   R   (   R$   (    (    sE   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/paths.pyt   get_ipython_package_dirY   s    c         C   se   |  d k r" t  j j t ƒ  d ƒ St |  ƒ } | j j d d ƒ } | j d d ƒ } t j | t	 ƒ S(   só   Find the path to an IPython module in this version of IPython.

    This will always find the version of the module that is in this importable
    IPython package. This will always return the path to the ``.py``
    version of the module.
    R+   s   __init__.pys   .pycs   .pys   .pyo(
   R   R   R   R-   R   R,   t   replaceR
   R   R   (   t
   module_strt   modt   the_path(    (    sE   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/paths.pyt   get_ipython_module_path_   s    t   defaultc         C   sZ   d d l  m } m } y | j t ƒ  |  ƒ } Wn! | k
 rR t d |  ƒ ‚ n X| j S(   sn   Find the path to the folder associated with a given profile.

    I.e. find $IPYTHONDIR/profile_whatever.
    iÿÿÿÿ(   t
   ProfileDirt   ProfileDirErrors   Couldn't find profile %r(   t   IPython.core.profiledirR4   R5   t   find_profile_dir_by_nameR(   t   IOErrort   location(   t   profileR4   R5   t   pd(    (    sE   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/paths.pyt   locate_profilem   s    (   t   __doc__t   os.pathR   R   R   t   warningsR    R+   t   IPython.utils.importstringR   t   IPython.utils.pathR   R   R   R   R   R   R   R	   t   IPython.utilsR
   R(   R*   R-   R2   R<   (    (    (    sE   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/paths.pyt   <module>   s   :	;			