U
    /e                  
   @   s  d Z ddlZzddlZdd ZejjZW n   dd Zdd ZY nX dZzejd dkZW n   Y nX zW n   e	d	 Y nX ej
d
krddlZdd Zndd Zdd Zdd Ze ZereZeZneZeZdd Zdd Zdd ZedkrzddlZed W n   Y nX zeeejZW n   eejZY nX ej
d
krleedsleed7 Zz eejd Zeejd ZW nL ek
r   ddl Z e !ej"dd Z#e !e#dZ#e#d Ze#d ZY nX edeeeef Z#edgZ$e$%ed ee#f  e$%ed!ee  eeej&Z&g Z'ejZ(ze(dd Z(W n   Y nX e(D ]Z)eee)Z)z<ddl Z e *e)e&dkre'%e)d"f ne'%e)d#f W nD e+efk
r   e),e&re'%e)d"f ne'%e)d#f Y nX qde'D ]:\Z)Z-e-r"e$%ed$e)f  ne$%ed%e)f  qej.D ]Z/e$%ed&ee/  q@e$%ed' ed(e$Z0ee0Z1erej2j34e1 nej24e1 ej25  ej65  dS ))a  
This module was created to get information available in the interpreter, such as libraries,
paths, etc.

what is what:
sys.builtin_module_names: contains the builtin modules embeeded in python (rigth now, we specify all manually).
sys.prefix: A string giving the site-specific directory prefix where the platform independent Python files are installed

format is something as
EXECUTABLE:python.exe|libs@compiled_dlls$builtin_mods

all internal are separated by |
    Nc                 C   s   t j| S zdfixes the path so that the format of the path really reflects the directories in the system
        )ospathnormpathr    r   L/tmp/pip-unpacked-wheel-dg3irmqq/debugpy/_vendored/pydevd/interpreterInfo.pyfully_normalize_path   s    r	   c                 C   s   | S r   r   r   r   r   r   r	      s    c                 C   s(   |  ds|  dr| | S | d | S )N/\)endswith)abr   r   r   join!   s    r      zTrue, False = 1,0cygwinc                 C   sD   d}t |}t| } t| } d}t jd}||| || |jS )Ni   r   zcygwin1.dll)ctypescreate_string_bufferr	   tobytescdllLoadLibraryZcygwin_conv_pathvalue)r   MAX_PATHretvalZCCP_POSIX_TO_WIN_AZ
cygwin1dllr   r   r   native_path9   s    
r   c                 C   s   t | S )N)r	   r   r   r   r   r   H   s    c               	   C   s   zt  } | std| W S    z8ddlm} |d }|ddkrTW Y dS W Y dS    Y nX t jd	krxY d
S Y dS X dS )zN
    Note: there's a copy of this method in _pydev_filesystem_encoding.py
    zUnable to get encoding.r   )Systemzos.namewinz
ISO-8859-1utf-8win32mbcsN)	sysgetfilesystemencodingRuntimeError	java.langr   getPropertylowerfindplatform)retr   envr   r   r   __getfilesystemencodingL   s"    
r+   c                  C   sH   z4t  } tddrd|  tddr0d|  | W S    Y dS X d S )N encodedecoder   )r+   hasattrr-   r.   )r)   r   r   r   r"   f   s    



r"   c                 C   s"   t | drt| ts| tS | S )Nr.   )r/   
isinstanceunicode_typer.   file_system_encodingsr   r   r   	tounicode   s    


r5   c                 C   s"   t | drt| ts| tS | S )Nr-   )r/   r0   
bytes_typer-   r2   r3   r   r   r   r      s    


r   c                 C   s   |  dd} z| dd}W np   d}| D ]Z}z||d7 }W q,   z|tdt| 7 }W n   |dt| 7 }Y nX Y q,X q,Y nX |S )N&z&amp;asciixmlcharrefreplacer,   z&#%d;)replacer-   unicodeord)r4   r)   cr   r   r   
toasciimxl   s    $r>   __main__g?z.exe    .z%s.%sz<xml>z<version>%s</version>z<executable>%s</executable>TFz<lib path="ins">%s</lib>z<lib path="out">%s</lib>z<forced_lib>%s</forced_lib>z</xml>
)7__doc__r!   os.pathr   r	   r   r   ZIS_PYTHON_3_ONWARDSversion_infoexecr(   r   r   r+   r"   r2   strr1   bytesr6   r;   r5   r   r>   __name__timesleep
executabler   majorminorAttributeErrorstringsplitversionr4   contentsappendprefixresultZ	path_usedpr'   ImportError
startswithr   builtin_module_namesZ
builtinModZunicZ
inasciixmlstdoutbufferwriteflushstderrr   r   r   r   <module>   s   





