Current File : //usr/lib64/python2.7/site-packages/numpy/distutils/lib2def.pyo
�
E�`Qc@saddlZddlZddlZddlZdZdZdeejd �ZdZ	deZ
ejdeej�Z
ejd	eej�Zd
�Zddd
egd�Zd�Zejd�Zedkr]e�\ZZedkrejZneed�Zee	�ee�gZee�Zee�\ZZeeee
e�ndS(i����Ns�This module generates a DEF file from the symbols in
an MSVC-compiled DLL import library.  It correctly discriminates between
data and functions.  The data is collected from the output of the program
nm(1).

Usage:
    python lib2def.py [libname.lib] [output.def]
or
    python lib2def.py [libname.lib] > output.def

libname.lib defaults to python<py_ver>.lib and output.def defaults to stdout

Author: Robert Kern <kernr@mail.ncifcrf.gov>
Last Update: April 30, 1999
s0.1as%d%disnm -CssrLIBRARY         python%s.dll
;CODE           PRELOAD MOVEABLE DISCARDABLE
;DATA           PRELOAD SINGLE

EXPORTS
s^(.*) in python%s\.dlls^_imp__(.*) in python%s\.dllcCs:ttj�dkr�tjdddkrYtjdddkrYtjd\}}q0tjdddkr�tjdddkr�tjd\}}q0dGHdGHn�ttj�dkr tjdddkr�tjd}d	t}q0tjdddkr0d
}tjd}q0nd	t}d
}||fS(sBParses the command-line arguments.

libfile, deffile = parse_cmd()iii����s.libis.defs4I'm assuming that your first argument is the librarysand the second is the DEF file.spython%s.libN(tlentsystargvtpy_vertNone(tlibfiletdeffile((s=/usr/lib64/python2.7/site-packages/numpy/distutils/lib2def.pyt	parse_cmd's"..


tnms-Csspython%s.libcCs>tj|dtdtj�}|jj�}|jj�|S(sVReturns the output of nm_cmd via a pipe.

nm_output = getnam(nm_cmd = 'nm -Cs py_lib')tshelltstdout(t
subprocesstPopentTruetPIPER
treadtclose(tnm_cmdtft	nm_output((s=/usr/lib64/python2.7/site-packages/numpy/distutils/lib2def.pytgetnm?s
cCs�tj|�}tj|�}g}xZ|D]R}||kr+|d dksm|d dksm|d dkr+|j|�q+q+Wg}xJ|D]B}||kr�|d dks�|d dkr�|j|�q�q�W|j�|j�||fS(s�Returns a tuple of lists: dlist for the list of data
symbols and flist for the list of function symbols.

dlist, flist = parse_nm(nm_output)itPyit_Pyitinit(tDATA_REtfindalltFUNC_REtappendtsort(Rtdatatfunctflisttsymtdlist((s=/usr/lib64/python2.7/site-packages/numpy/distutils/lib2def.pytparse_nmHs
<
,

cCsYx|D]}|d|}qW|d}x|D]}|d|}q0W|j|�dS(soOutputs the final DEF file to a file defaulting to stdout.

output_def(dlist, flist, header, file = sys.stdout)s		%s DATA
s
s	%s
N(twrite(R!Rtheadertfiletdata_symtfunc_sym((s=/usr/lib64/python2.7/site-packages/numpy/distutils/lib2def.pyt
output_def^s


t__main__tw(treRtosRt__doc__t__version__ttupletversion_infoRt
DEFAULT_NMt
DEF_HEADERtcompilet	MULTILINERRRRR"R
R(t__name__RRRtopentstrRRR!R(((s=/usr/lib64/python2.7/site-packages/numpy/distutils/lib2def.pyt<module>s.