ó
q]c           @   sk   d  Z  d d l Z d d l Z d d l Z d d l Z d   Z d   Z d   Z e d k rg e   n  d S(   sl   
display environment information that isfrequently
used to troubleshoot installations of Jupyter or IPython
i˙˙˙˙Nc         C   sK   y) t  j |   } | j d d  j   SWn t t  j f k
 rF d SXd S(   sF   
    get data from commands that we need to run outside of python
    s   utf-8t   replaceN(   t
   subprocesst   check_outputt   decodet   stript   OSErrort   CalledProcessErrort   None(   t   cmdt   stdout(    (    s8   lib/python2.7/site-packages/jupyter_core/troubleshoot.pyt   subs   s
    c          C   sá   i  }  t  j j d  |  d <t j |  d <t j |  d <t j |  d <t j   |  d <t j d k r t d d	 g  |  d <d |  d
 <n# t d
 d d	 g  |  d
 <d |  d <t t j d d d g  |  d <t d d g  |  d <|  S(   s9   
    returns a dict of various user environment data
    t   PATHt   patht   sys_patht   sys_exet   sys_versiont   platformt   win32t   wheret   jupytert   whichs   -as   -mt   pipt   listt   condaN(
   t   ost   environt   gett   sysR   t
   executablet   versionR   R
   R   (   t   env(    (    s8   lib/python2.7/site-packages/jupyter_core/troubleshoot.pyt   get_data   s    
c          C   sˇ  t    }  d GHx' |  d j t j  D] } d | GHq% Wd GHx |  d D] } d | GHqH Wd GHd |  d GHd GHd |  d
 k rŹ x4 |  d
 j d  D] } d | GHq Wn d |  d
 GHd d GHd |  d GH|  d rd GHx' |  d j d  D] } d | GHqň Wn  |  d rAd GHx' |  d j d  D] } d | GHq+Wn  |  d rzd GHx' |  d j d  D] } d | GHqdWn  |  d rłd GHx' |  d j d  D] } d | GHqWn  d S(   s   
    print out useful info
    s   $PATH:R   s   	s   
s	   sys.path:R   s   sys.executable:R   s   sys.version:R   s   platform.platform():R   R   s   which -a jupyter:R   s   where jupyter:R   s	   pip list:R   s   conda list:Ns
   
sys.path:s   
sys.executable:s   
sys.version:s   
which -a jupyter:s   
where jupyter:s
   
pip list:s   
conda list:(   R   t   splitR   t   pathsep(   t   environment_datat	   directoryt   datat   linet   package(    (    s8   lib/python2.7/site-packages/jupyter_core/troubleshoot.pyt   main5   s@    		



t   __main__(	   t   __doc__R   R   R   R   R
   R   R'   t   __name__(    (    (    s8   lib/python2.7/site-packages/jupyter_core/troubleshoot.pyt   <module>   s   				2