}BFjdZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z de dee e ffdZde defd Zdefd Zde fd ZdS) zQ Utilities for getting information about IPython and the system it's running in. N)Path)release)_sysinfoencodingpkg_pathreturnc<tjrdtjfStjddtjtj|}|\}}|r)d|dfSdS)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 installationzgit rev-parse --short HEAD )stdoutstderrcwd repositoryascii)z (none found)z ) rcommit subprocessPopensplitPIPE communicatestripdecode)rproc repo_commit_s CC:\PYTHON\_runtimes\venv\Lib\site-packages\IPython/utils/sysinfo.pypkg_commit_hashr s0/x..  8>>sCC#-?#-? ( * * *D%%''NKA[..0077@@@@ ( (c t|\}}ttj|||tjtjtjt jtjtj  S)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_versionsys_executable sys_platformplatformos_namedefault_encoding) rdictrversionsys executabler'osnamerDEFAULT_ENCODING)rsrchshs rpkg_infor3Fs`x((HC K~\"$$!2  rcttdj}t t |S)zBReturn useful information about IPython and the system, as a dict.z..)r__file__resolveparentr3str)paths r get_sys_infor:as4 $   ' ' ) ) 0D CII  rcBtjtS)auReturn 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]'} )pprintpformatr:rrsys_infor?fs$ >,.. ) ))r)__doc__r.r'r<r,rpathlibr IPython.corer IPython.utilsrrr8tuplerr*r3r:r?r>rrrEs    ,,,,,,,, #)c#)eCHo#)#)#)#)L s t    6d *#******r