Your IP : 216.73.216.85


Current Path : /opt/alt/python37/lib64/python3.7/Tools/scripts/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/Tools/scripts/__pycache__/nm2def.cpython-37.opt-1.pyc

B

� f�	�@s�dZddlZddlZdejdd�Zdejdd�ZdZedfdd	�Zd
d�ZdZ	d
Z
e
fdd�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).

�Nzlibpython%d.%d.a�zPython%d%d.dllznm -p -g %s)�T�C�Dc	Cs�t�t|���}dd�|D�}i}xX|D]P}t|�dks*d|krDq*|��}t|�dkrZq*|\}}}||krnq*||f||<q*W|S)NcSsg|]}|���qS�)�strip)�.0�srr�9/opt/alt/python37/lib64/python3.7/Tools/scripts/nm2def.py�
<listcomp>.szsymbols.<locals>.<listcomp>r�:�)�os�popen�NM�	readlines�len�split)	�lib�types�lines�symbols�line�itemsZaddress�type�namerrr
r+s

rcCszg}g}x>|��D]2\}\}}|dkr6|�d|�q|�d|�qW|��|�d�|��d�|�dd�|�S)N)rr�	�z DATA
�
)r�append�sort�join)r�data�coderZaddrrrrr
�export_list<s
r$zEXPORTS
%s
rcCsJxDt|���D]4}|dd�dksB|dd�dkr4q||kr||=qWdS)NrZPyr
Z_Py)�list�keys)rZspecialsrrrr
�
filter_PythonUs
 r'cCs8tt�}t|�t|�}tj}|�t|�|��dS)N)	r�	PYTHONLIBr'r$�sys�stdout�write�DEF_TEMPLATE�close)r	Zexports�frrr
�main]sr/�__main__)�__doc__rr)�version_infor(ZPC_PYTHONLIBrrr$r,ZSPECIALSr'r/�__name__rrrr
�<module>$s