HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //opt/alt/python37/lib64/python3.7/site-packages/numpy/distutils/__pycache__/lib2def.cpython-37.pyc
B

��Fd�
�@sddlmZmZmZddlZddlZddlZddlZdZdZ	de
ejdd��ZdZ
deZe�d	eej�Ze�d
eej�Zdd�Zd
ddegfdd�Zdd�Zejfdd�Zedk�re�\ZZedkr�ejZn
eed�Zee
�ee�gZee�Zee�\ZZ eee ee�dS)�)�division�absolute_import�print_functionNa�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
z0.1az%d%d�znm -CszrLIBRARY         python%s.dll
;CODE           PRELOAD MOVEABLE DISCARDABLE
;DATA           PRELOAD SINGLE

EXPORTS
z^(.*) in python%s\.dllz^_imp__(.*) in python%s\.dllcCsttj�dkr�tjddd�dkrNtjddd�dkrNtjdd�\}}nPtjddd�dkr�tjddd�dkr�tjdd�\}}ntd�td	�njttj�dkr�tjddd�dkr�tjd}d
t}n$tjddd�dkr�d}tjd}nd
t}d}||fS)zBParses the command-line arguments.

libfile, deffile = parse_cmd()�����Nz.librz.defz4I'm assuming that your first argument is the libraryzand the second is the DEF file.zpython%s.lib)�len�sys�argv�print�py_ver)�libfile�deffile�r�J/opt/alt/python37/lib64/python3.7/site-packages/numpy/distutils/lib2def.py�	parse_cmd)s",,


r�nmz-Cszpython%s.libcCs,tj|dtjdd�}|j��}|j��|S)zVReturns the output of nm_cmd via a pipe.

nm_output = getnam(nm_cmd = 'nm -Cs py_lib')T)�shell�stdout�universal_newlines)�
subprocess�Popen�PIPEr�read�close)�nm_cmd�f�	nm_outputrrr�getnmAs

rcCs�t�|�}t�|�}g}xN|D]F}||kr|dd�dksZ|dd�dksZ|dd�dkr|�|�qWg}x>|D]6}||krr|dd�dks�|dd�dkrr|�|�qrW|��|��||fS)z�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)NrZPyrZ_Py��init)�DATA_RE�findall�FUNC_RE�append�sort)r�data�func�flist�sym�dlistrrr�parse_nmJs


8
(r,cCsJx|D]}|d|}qW|d}x|D]}|d|}q(W|�|�dS)zoOutputs the final DEF file to a file defaulting to stdout.

output_def(dlist, flist, header, file = sys.stdout)z		%s DATA
�
z	%s
N)�write)r+r)�header�fileZdata_symZfunc_symrrr�
output_def`s

r1�__main__�w)!�
__future__rrr�rer
�osr�__doc__�__version__�tuple�version_infor
�
DEFAULT_NM�
DEF_HEADER�compile�	MULTILINEr$r"rrr,rr1�__name__rr�open�strrrr+r)rrrr�<module>s0