+
    ^|i                         R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
HtHt R R ltR R ltR	 R
 ltR R ltR# )zQ
Utilities for getting information about IPython and the system it's running in.
N)Path)release)_sysinfoencodingc                R    V ^8  d   QhR\         R\        \         \         3,          /#    pkg_pathreturn)strtuple)formats   "7/usr/lib/python3/dist-packages/IPython/utils/sysinfo.py__annotate__r       s"     #) #)c #)eCHo #)    c                V   \         P                  '       d   R\         P                  3# \        P                  ! RP	                  R4      \        P
                  \        P
                  V R7      pVP                  4       w  r#V'       d"   RVP                  4       P                  R4      3# R# )a  Get short form of commit hash given directory `pkg_path`

We get the commit hash from (in order of preference):

* IPython.utils._sysinfo.commit
* git output, if we are in a git repository

If these fail, we return a not-found placeholder tuple

Parameters
----------
pkg_path : str
    directory containing package
    only used for getting commit from active repo

Returns
-------
hash_from : str
    Where we got the hash from - description
hash_str : str
    short form of hash
installationzgit rev-parse --short HEAD )stdoutstderrcwd
repositoryascii)z(none found)z<not found>)	r   commit
subprocessPopensplitPIPEcommunicatestripdecode)r	   procrepo_commit_s   &   r   pkg_commit_hashr$       s    0 x.. 8>>sC#-??#-?? (*D %%'NK[..077@@@((r   c                0    V ^8  d   QhR\         R\        /# r   )r   dict)r   s   "r   r   r   F   s     
 
s 
t 
r   c                   \        V 4      w  r\        \        P                  V VV\        P                  \        P
                  \        P                  \        P                  ! 4       \        P                  \        P                  R7
      # )zReturn dict describing the context of this package

Parameters
----------
pkg_path : str
    path containing __init__.py for package

Returns
-------
context : dict
    with named parameters of interest
)
ipython_versionipython_pathcommit_sourcecommit_hashsys_versionsys_executablesys_platformplatformos_namedefault_encoding)r$   r&   r   versionsys
executabler/   osnamer   DEFAULT_ENCODING)r	   srchshs   &  r   pkg_infor:   F   s^     x(HCKK~~\\""$!22
 
r   c                $    V ^8  d   QhR\         /# r   r
   )r&   )r   s   "r   r   r   a   s      d r   c                 z    \        \        R4      P                  4       P                  p \	        \        V 4      4      # )zBReturn useful information about IPython and the system, as a dict.z..)r   __file__resolveparentr:   r   )paths    r   get_sys_inforB   a   s,    $'')00DCIr   c                $    V ^8  d   QhR\         /# r<   )r   )r   s   "r   r   r   f   s     * *# *r   c                 >    \         P                  ! \        4       4      # )a9  Return useful information about IPython and the system, as a string.

Examples
--------
::

    In [2]: print(sys_info())
    {'commit_hash': '144fdae',      # random
     'commit_source': 'repository',
     'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython',
     'ipython_version': '0.11.dev',
     'os_name': 'posix',
     'platform': 'Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick',
     'sys_executable': '/usr/bin/python',
     'sys_platform': 'linux2',
     'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \n[GCC 4.4.5]'}
)pprintpformatrB    r   r   sys_inforH   f   s    $ >>,.))r   )__doc__r5   r/   rE   r3   r   pathlibr   IPython.corer   IPython.utilsr   r   r$   r:   rB   rH   rG   r   r   <module>rM      s9    
   
     ,#)L
6
*r   