Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/Tools/scripts/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/Tools/scripts/__pycache__/nm2def.cpython-35.pyc



��Yf�	�@s�dZddlZddlZdejdd�dZdejdejddZd	Zedd
d�Zdd�ZdZ	fZ
e
dd�Zdd�Ze
dkr�e�dS)aEnm2def.py

Helpers to extract symbols from Unix libs and auto-generate
Windows definition files from them. Depends on nm(1). Tested
on Linux and Solaris only (-p option to nm is for Solaris only).

By Marc-Andre Lemburg, Aug 1998.

Additional notes: the output of nm is supposed to look like this:

acceler.o:
000001fd T PyGrammar_AddAccelerators
         U PyGrammar_FindDFA
00000237 T PyGrammar_RemoveAccelerators
         U _IO_stderr_
         U exit
         U fprintf
         U free
         U malloc
         U printf

grammar1.o:
00000000 T PyGrammar_FindDFA
00000034 T PyGrammar_LabelRepr
         U _PyParser_TokenNames
         U abort
         U printf
         U sprintf

...

Even if this isn't the default output of your nm, there is generally an
option to produce this format (since it is the original v7 Unix format).

�NZ	libpython�z.a�Python�z.dllznm -p -g %s�T�C�Dc	Cs�tjt|�j�}dd�|D�}i}x~|D]v}t|�dks9d|kr`q9|j�}t|�dkr�q9|\}}}||kr�q9||f||<q9W|S)NcSsg|]}|j��qS�)�strip)�.0�srr�9/opt/alt/python35/lib64/python3.5/Tools/scripts/nm2def.py�
<listcomp>.s	zsymbols.<locals>.<listcomp>r�:r)�os�popen�NM�	readlines�len�split)	�lib�types�lines�symbols�line�itemsZaddress�type�namerrrr+s
rcCs�g}g}xQ|j�D]C\}\}}|dkrK|jd|�q|jd|�qW|j�|jd�|j�dj|�ddj|�S)Nrr�	�z DATA
�
)rr)r�append�sort�join)r�data�coderZaddrrrrr�export_list<s


r%zEXPORTS
%s
cCscx\t|j��D]H}|dd�dks[|dd�dkrHq||kr||=qWdS)NrZPyrZ_Py)�list�keys)rZspecialsrrrr�
filter_PythonUs
,r(cCsJtt�}t|�t|�}tj}|jt|�|j�dS)N)	r�	PYTHONLIBr(r%�sys�stdout�write�DEF_TEMPLATE�close)rZexports�frrr�main]s
	r0�__main__)rrr)�__doc__rr*�versionr)ZPC_PYTHONLIBrrr%r-ZSPECIALSr(r0�__name__rrrr�<module>$s