3
[                 @   s   d dl mZ d dlZd dlZd dlZyd dlmZ dZW nh ek
r   dZyd dl	m
Z W n> ek
r   yd dl	mZ W n ek
r   dZY nX Y nX Y nX dd	lmZ G d
d deZdS )    )absolute_importN)etreeTF)cElementTree)ElementTree   )Errorsc               @   s:   e Zd ZdZdd ZdddZdd Zd	d
 Zdd ZdS )CythonDebugWriterz
    Class to output debugging information for cygdb

    It writes debug information to cython_debug/cython_debug_info_<modulename>
    in the build directory.
    c             C   sN   t d krtj tjj|ptjd| _t j | _	d | _
| jdtddd d S )Ncython_debugz1.0)version)attrs)r   r   NoElementTreeInstalledExceptionospathjoincurdir
output_dirZTreeBuildertbmodule_namestartdict)selfr    r   k/home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.6/site-packages/Cython/Debugger/DebugWriter.py__init__   s    
zCythonDebugWriter.__init__Nc             C   s   | j j||pi  d S )N)r   r   )r   namer   r   r   r   r   )   s    zCythonDebugWriter.startc             C   s   | j j| d S )N)r   end)r   r   r   r   r   r   ,   s    zCythonDebugWriter.endc             K   s   | j j|| | j j| d S )N)r   r   r   )r   r   r   r   r   r   	add_entry/   s    zCythonDebugWriter.add_entryc             C   s   | j jd | j jd | j j }ytj| j W n0 tk
rb } z|jtjkrR W Y d d }~X nX t	j
|}i }tr~d|d< d| j }|jtjj| j|fddi| tjj| jd}t|d	}|jtj W d Q R X d S )
NModuler	   TZpretty_printZcython_debug_info_encodingzUTF-8Zinterpreterw)r   r   closer   makedirsr   OSErrorerrnoEEXISTr   r   	have_lxmlr   writer   r   opensys
executable)r   Zxml_root_elementeetkwfnZinterpreter_pathfr   r   r   	serialize3   s"    


"zCythonDebugWriter.serialize)N)	__name__
__module____qualname____doc__r   r   r   r   r/   r   r   r   r   r      s   

r   )
__future__r   r   r(   r#   Zlxmlr   r%   ImportErrorZ	xml.etreer   r   Compilerr   objectr   r   r   r   r   <module>   s"   