add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
3

�
�^l/c@s�dZddlZddlmZdZdadZiZiZiZ	iZ
dd�Zdd	�ZGd
d�d�Z
Gdd
�d
�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�Zdd�Zdd�Zd d!�Zed"kr�dd#lmZed$d%d&d'�dS)(a�Support for remote Python debugging.

Some ASCII art to describe the structure:

       IN PYTHON SUBPROCESS          #             IN IDLE PROCESS
                                     #
                                     #        oid='gui_adapter'
                 +----------+        #       +------------+          +-----+
                 | GUIProxy |--remote#call-->| GUIAdapter |--calls-->| GUI |
+-----+--calls-->+----------+        #       +------------+          +-----+
| Idb |                               #                             /
+-----+<-calls--+------------+         #      +----------+<--calls-/
                | IdbAdapter |<--remote#call--| IdbProxy |
                +------------+         #      +----------+
                oid='idb_adapter'      #

The purpose of the Proxy and Adapter classes is to translate certain
arguments and return values that cannot be transported through the RPC
barrier, in particular frame and traceback objects.

�N)�debugger�idb_adapterZgui_adaptercCst|�}|t|<|S�N)�id�
frametable)�frame�fid�r�*/usr/lib64/python3.6/idlelib/debugger_r.py�
wrap_frame(sr
cCsN|dkrdS|d}t|tj�s$t�t|�}|t|<|d|d|f}|SdS)z0replace info[2], a traceback instance, by its IDN�r�)Z
isinstance�typesZ
TracebackType�AssertionErrorr�tracebacktable)�infoZ	tracebackZtraceback_id�
modified_inforrr	�	wrap_info-src@seZdZdd�Zddd�ZdS)�GUIProxycC�||_||_dSr)�conn�oid)�selfr�gui_adap_oidrrr	�__init__;�zGUIProxy.__init__NcCs&|jj|jd|t|�t|�fi�dS)N�interaction)r�
remotecallrr
r)r�messagerrrrr	r?szGUIProxy.interactionr��__name__�
__module__�__qualname__rrrrrr	r9�rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�
IdbAdaptercCs
||_dSr)�idb)rr$rrr	rH�zIdbAdapter.__init__cC�|jj�dSr)r$�set_step�rrrr	r'Mr%zIdbAdapter.set_stepcCr&r)r$�set_quitr(rrr	r)Pr%zIdbAdapter.set_quitcCr&r)r$�set_continuer(rrr	r*Sr%zIdbAdapter.set_continuecC�t|}|jj|�dSr)rr$�set_next�rrrrrr	r,V�zIdbAdapter.set_nextcCr+r)rr$�
set_returnr-rrr	r/Zr.zIdbAdapter.set_returncCsFt|}|dkrd}nt|}|jj||�\}}dd�|D�}||fS)NcSsg|]\}}t|�|f�qSr)r
)�.0Zframe2�krrr	�
<listcomp>e�z(IdbAdapter.get_stack.<locals>.<listcomp>)rrr$�	get_stack)rr�tbidrZtb�stack�irrr	r4^szIdbAdapter.get_stackcCsddl}|jj||j�dS)Nr)�__main__r$�runZ__dict__)r�cmdr8rrr	r9hr.zIdbAdapter.runcC�|jj||�}|Sr)r$�	set_break�r�filenameZlineno�msgrrr	r<l�zIdbAdapter.set_breakcCr;r)r$�clear_breakr=rrr	rApr@zIdbAdapter.clear_breakcCs|jj|�}|Sr)r$�clear_all_file_breaks�rr>r?rrr	rBt�z IdbAdapter.clear_all_file_breakscCst|}t||�Sr)rZgetattr)rr�namerrrr	�
frame_attrzr.zIdbAdapter.frame_attrcC�"t|}|j}t|�}|t|<|Sr)r�	f_globalsr�	dicttable�rrr�dict�didrrr	�
frame_globals~�
zIdbAdapter.frame_globalscCrGr)r�f_localsrrIrJrrr	�frame_locals�rNzIdbAdapter.frame_localscCrGr)r�f_coder�	codetable)rrr�code�cidrrr	�
frame_code�rNzIdbAdapter.frame_codecC�t|}|jSr)rR�co_name�rrTrSrrr	�	code_name�r.zIdbAdapter.code_namecCrVr)rR�co_filenamerXrrr	�
code_filename�r.zIdbAdapter.code_filenamecCstd��dS)Nz"dict_keys not public or pickleable)ZNotImplementedError�rrLrrr	�	dict_keys�r%zIdbAdapter.dict_keyscCst|}t|j��Sr)rIZlist�keys)rrLrKrrr	�dict_keys_list�r.zIdbAdapter.dict_keys_listcCst|}||}t|�}|Sr)rIZrepr)rrL�keyrK�valuerrr	�	dict_item�szIdbAdapter.dict_itemN)rr r!rr'r)r*r,r/r4r9r<rArBrFrMrPrUrYr[r]r_rbrrrr	r#Fs(
	r#cCs,t||�}tj|�}t|�}|jt|�tS)a|Start the debugger and its RPC link in the Python subprocess

    Start the subprocess side of the split debugger and set up that side of the
    RPC link by instantiating the GUIProxy, Idb debugger, and IdbAdapter
    objects and linking them together.  Register the IdbAdapter with the
    RPCServer to handle RPC requests from the split debugger GUI via the
    IdbProxy.

    )rrZIdbr#�register�idb_adap_oid)Z
rpchandlerrZ	gui_proxyr$Zidb_adaprrr	�start_debugger�s



rec@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
FrameProxycCs||_||_d|_i|_dS)Nr)�_conn�_fid�_oid�
_dictcache)rrrrrr	r�szFrameProxy.__init__cCsb|dd�dkrt|��|dkr(|j�S|dkr8|j�S|dkrH|j�S|jj|jd|j|fi�S)NrZ_rQrHrOrF)�AttributeError�_get_f_code�_get_f_globals�
_get_f_localsrgrrirh�rrErrr	�__getattr__�szFrameProxy.__getattr__cCs(|jj|jd|jfi�}t|j|j|�S)NrU)rgrrirh�	CodeProxy)rrTrrr	rl�szFrameProxy._get_f_codecC�"|jj|jd|jfi�}|j|�S)NrM�rgrrirh�_get_dict_proxyr\rrr	rm��zFrameProxy._get_f_globalscCrr)NrPrsr\rrr	rn�ruzFrameProxy._get_f_localscCs2||jkr|j|St|j|j|�}||j|<|Sr)rj�	DictProxyrgri)rrLZdprrr	rt�s



zFrameProxy._get_dict_proxyN)	rr r!rrprlrmrnrtrrrr	rf�srfc@�eZdZdd�Zdd�ZdS)rqcC�||_||_||_dSr)rgri�_cid)rrrrTrrr	r��zCodeProxy.__init__cCsD|dkr |jj|jd|jfi�S|dkr@|jj|jd|jfi�SdS)NrWrYrZr[)rgrriryrorrr	rp�szCodeProxy.__getattr__N)rr r!rrprrrr	rq�srqc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rvcCrxr)rgri�_did)rrrrLrrr	rrzzDictProxy.__init__cCs|jj|jd|jfi�S)Nr_�rgrrir{r(rrr	r^s
zDictProxy.keyscCs|jj|jd|j|fi�S)Nrbr|)rr`rrr	�__getitem__rDzDictProxy.__getitem__cCst|��dSr)rkrorrr	rpszDictProxy.__getattr__N)rr r!rr^r}rprrrr	rvs	rvc@rw)�
GUIAdaptercCrr)r�gui)rrrrrr	rrzGUIAdapter.__init__cCs t|j|�}|jj|||�dSr)rfrrr)rrrrrrrr	r!szGUIAdapter.interactionNrrrrr	r~r"r~c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�IdbProxycCs||_||_||_dSr)rr�shell)rrr�rrrr	r)rzzIdbProxy.__init__cOs|jj|j|||�}|Sr)rrr)rZ
methodnameZargsZkwargsrarrr	�call.sz
IdbProxy.callcCs$|jj|jd|fi�}||jj_dS)Nr9)rZ
asyncqueuerr�ZinterpZ
active_seq)rr:ZlocalsZseqrrr	r94szIdbProxy.runcs.�jd|j|�\}}�fdd�|D�}||fS)Nr4cs g|]\}}t�j|�|f�qSr)rfr)r0rr1r(rr	r2<r3z&IdbProxy.get_stack.<locals>.<listcomp>�r�rh)rrr5r6r7rr(r	r49szIdbProxy.get_stackcC�|jd�dS)Nr*�r�r(rrr	r*?r%zIdbProxy.set_continuecCr�)Nr'r�r(rrr	r'Br%zIdbProxy.set_stepcC�|jd|j�dS)Nr,r��rrrrr	r,Er%zIdbProxy.set_nextcCr�)Nr/r�r�rrr	r/Hr%zIdbProxy.set_returncCr�)Nr)r�r(rrr	r)Kr%zIdbProxy.set_quitcC�|jd||�}|S)Nr<r�r=rrr	r<Nr@zIdbProxy.set_breakcCr�)NrAr�r=rrr	rARr@zIdbProxy.clear_breakcCs|jd|�}|S)NrBr�rCrrr	rBVrDzIdbProxy.clear_all_file_breaksN)rr r!rr�r9r4r*r'r,r/r)r<rArBrrrr	r�'sr�cCsD|jddtfi�at||t�}tj||�}t||�}|jt|�|S)a]Start the subprocess debugger, initialize the debugger GUI and RPC link

    Request the RPCServer start the Python subprocess debugger and link.  Set
    up the Idle side of the split debugger by instantiating the IdbProxy,
    debugger GUI, and debugger GUIAdapter objects and linking them together.

    Register the GUIAdapter with the RPCClient to handle debugger GUI
    interaction requests coming from the subprocess debugger via the GUIProxy.

    The IdbAdapter will pass execution and environment requests coming from the
    Idle debugger GUI to the subprocess debugger via the IdbProxy.

    �exec�start_the_debugger)rrrdr�rZDebuggerr~rc)�rpccltZpyshellZ	idb_proxyrZgui_adaprrr	�start_remote_debuggerZs

r�cCst|�|jt�dS)a]Shut down subprocess debugger and Idle side of debugger RPC link

    Request that the RPCServer shut down the subprocess debugger and link.
    Unregister the GUIAdapter, which will cause a GC on the Idle process
    debugger and RPC link objects.  (The second reference to the debugger GUI
    is deleted in pyshell.close_remote_debugger().)

    N)�close_subprocess_debuggerZ
unregisterr�r�rrr	�close_remote_debuggerrs	r�cCs|jddtfi�dS)Nr�Zstop_the_debugger)rrdr�rrr	r�~r%r�cCs&|jddtfi�}|tks"td��dS)Nr�r�z Idb restarted with different oid)rrrdr)r�Zidb_adap_oid_retrrr	�restart_subprocess_debugger�s
r�r8)�mainzidlelib.idle_test.test_debuggerrF)Z	verbosityZexit)Z__doc__r
ZidlelibrZ	debuggingrdrrrIrRrr
rrr#rerfrqrvr~r�r�r�r�r�rZunittestr�rrrr	Z<module>s4
m*3