%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.9/site-packages/numpy/distutils/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.9/site-packages/numpy/distutils/__pycache__/mingw32ccompiler.cpython-39.pyc

a

z[ycW�@s�dZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlZddl
mZddlmZddlmZddlmZmZmZmZdd	�Ze�d
�Ze�d�ZGdd
�d
ejj�Zdd�Z dd�Z!dd�Z"dd�Z#d:dd�Z$dd�Z%dd�Z&dd�Z'dd �Z(iZ)ejd!k�r�z`ddl*Z*d"e)d#<d$e)d%<d&e)d'<e+e*d(d�Z,e,du�rre�-d)e,��.�\Z/Z0e,e)e/e0<[/[0[,Wne1�y�e
�2d*�Yn0d+d,�Z3d;d.d/�Z4d0d1�Z5d2d3�Z6d4d5�Z7d6d7�Z8d8d9�Z9dS)<a
Support code for building Python extensions on Windows.

    # NT stuff
    # 1. Make sure libpython<version>.a exists for gcc.  If not, build it.
    # 2. Force windows to use gcc (we're struggling with MSVC and g77 support)
    # 3. Force windows to use g77

�N)�log)�
UnixCCompiler)�get_build_version)�UnknownFileError)�msvc_runtime_library�msvc_runtime_version�msvc_runtime_major�get_build_architecturecCst�}|durgS|gS)zBReplacement for outdated version of get_msvcr from cygwinccompilerN)r)Zmsvcr�r
�F/usr/lib64/python3.9/site-packages/numpy/distutils/mingw32ccompiler.py�get_msvcr_replacement#srz\[Ordinal/Name Pointer\] Tablez$^\s+\[([\s*[0-9]*)\] ([a-zA-Z0-9_]*)c@s2eZdZdZdZddd�Zd
dd�Zdd
d�ZdS)�Mingw32CCompilerzH A modified MingW32 compiler compatible with an MSVC built Python.

    Zmingw32rcCs�tjj�||||�t�t�}tdd�}|s2|r<|�d�t�}|rV|�dd|�t�dkrt|j	ddd	d
d�n|j	dd
ddd�dg|_
dS)NT)�debugZNPY_MINGW_USE_CUSTOM_MSVCRZ__MSVCRT_VERSION__z0x%04i�AMD64z#gcc -g -DDEBUG -DMS_WIN64 -O0 -Wallz7gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypeszgcc -gzgcc -g -shared)�compilerZcompiler_soZ
linker_exeZ	linker_soz
gcc -O2 -Wallz!gcc -O2 -Wall -Wstrict-prototypeszg++ zg++ -sharedzg++)�	distutils�cygwinccompiler�CygwinCCompiler�__init__�build_import_library�build_msvcr_libraryZdefine_macrorr	Zset_executablesZcompiler_cxx)�self�verbose�dry_run�forceZ
msvcr_successZmsvcr_dbg_successZ
msvcr_versionr
r
rr5s4�


��zMingw32CCompiler.__init__NcCsZt�}|r|sg}|�|�||||||||d|	|
|||
f}tj}||d|jj��dS)N)r�appendr�link�__code__�co_argcount)rZtarget_descZobjectsZoutput_filename�
output_dirZ	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsrZ
extra_preargsZextra_postargsZ
build_tempZtarget_langZruntime_library�args�funcr
r
rrms.
�zMingw32CCompiler.link�c	Cs�|durd}g}|D]�}tj�tj�|��\}}tj�|�\}}|rP|dd�}||jddgvrrtd||f��|r�tj�|�}|dks�|dkr�|�tj�	||||j
��q|�tj�	|||j
��q|S)Nr"��.rcz.resz"unknown file type '%s' (from '%s'))�os�path�splitext�normcase�
splitdriveZsrc_extensionsr�basenamer�joinZ
obj_extension)	rZsource_filenamesZ	strip_dirrZ	obj_namesZsrc_name�base�ext�drvr
r
r�object_filenames�s.����z!Mingw32CCompiler.object_filenames)rrr)NrNNNN)rr")�__name__�
__module__�__qualname__�__doc__Z
compiler_typerrr/r
r
r
rr
.s �
@�
)�r
c
CsNtjg}ttd�r,tjtjkr,|�tj�n"ttd�rNtjtjkrN|�tj�gd�}g}|D]"}|D]}|�tj�||��qfq^dtj	vr�|�tj�tj	dd��t
tjdd��\}}t�
�}|dkr�d|�|�d	�}n |d
kr�d|�d�}n
d
|��}td|�|D]*}tj�||�}	tj�|	��r|	S�qtd||f��dS)N�base_prefix�real_prefix)r"�lib�binZ
SYSTEMROOTZSystem32�ZCPythonZpython�.dllZPyPyZlibpypyz-c.dllzUnknown platform zLooking for %sz%s not found in %s)�sys�prefix�hasattrr4rr5r%r&r+�environ�tuple�version_info�platformZpython_implementation�print�exists�
ValueError)
�stems�sub_dirsZlib_dirs�stem�folder�
major_version�
minor_version�implementationZdllname�dllr
r
r�find_python_dll�s2

rLcCst�dd|g�}|�d�S)Nzobjdump.exez-p�
)�
subprocess�check_output�split)rK�str
r
r�
dump_table�srRc	Cs,t|�}tt|��D]}t�||���rq8qtd��g}t|dt|��D]B}t�||���}|r�|�t	|�
d����|�
d�f�qNq�qNt|�dkr�t�
d|�t|d��`}|�dtj�|��|�d�|�d	�|�d
�|D]}|�d|d�q�Wd�n1�s0YdS)
z�Given a dll file location,  get all its exported symbols and dump them
    into the given def file.

    The .def file will be overwrittenzSymbol table not foundr#r8rzNo symbols found in %s�wzLIBRARY        %s
z,;CODE          PRELOAD MOVEABLE DISCARDABLE
z;DATA          PRELOAD SINGLE
z	
EXPORTS
z%s
N)rR�range�len�_START�match�decoderC�_TABLEr�int�group�stripr�warn�open�writer%r&r*)	rK�dfile�dump�iZsyms�j�m�d�sr
r
r�generate_def�s($


rgcs4ddd�t���fdd�}dd�}||�p2||�S)NZamd64Zx86)r�Intelcsdtj�tj�dd�d�}tj�|�s(dSt�|�D],\}}}||vr2�|vr2tj�||�Sq2dS)NZWINDIRz
C:\WINDOWSZwinsxs)r%r&r+r=�getrB�walk)�dll_nameZwinsxs_path�root�dirs�files�Zarchr
r�_find_dll_in_winsxs	s�z%find_dll.<locals>._find_dll_in_winsxscSsLtjgtjd�d�D].}tj�||�}tj�|�rtj�|�SqdS)N�PATH�;)	r:r;r%r=rPr&r+rB�abspath)rkr&�filepathr
r
r�_find_dll_in_pathsz#find_dll.<locals>._find_dll_in_path)r	)rkrprur
ror�find_dlls��rvFcCstjdkrdSt�}|dur*t�d�dS|dkr@t�d�dSt�}|rR|d7}d|}tj�tj	d|�}tj�
|�r�t�d	|f�d
S|d}t|�}|s�t�d|�dSd
|}tj�tj	d|�}t�
d||f�t||�dd|d|g}	t�|	�}
t�|�|
S)N�ntFz?Skip building import library: Runtime is not compiled with MSVC�Pz=Skip building msvcr library: custom functionality not presentrezlib%s.a�libsz(Skip building msvcr library: "%s" existsTr9z*Cannot build msvcr library: "%s" not foundz	lib%s.defz&Building msvcr library: "%s" (from %s)�dlltool�-d�-l)r%�namerrrrr&r+r:r;�isfilervr]�inforgrN�call�remove)rZ	msvcr_verZ
msvcr_nameZout_name�out_fileZmsvcr_dll_name�dll_file�def_name�def_file�cmdZretcoder
r
rrsH


���


rcCs@tjdkrdSt�}|dkr"t�S|dkr0t�Std|��dS)NrwrrhzUnhandled arch %s)r%r}r	�_build_import_library_amd64�_build_import_library_x86rCror
r
rrYs
rc
Cs�ttjdd��\}}gd�}tjg}ttd�rJtjtjkrJ|�tj�n"ttd�rltjtjkrl|�tj�ddg}g}|D]:}|||f}|D]$}|D]}	|�tj	�
||	|��q�q�q||D]}
tj	�|
�r�d|
fSq�d	|d
fS)zACheck if an import library for the Python runtime already exists.Nr8)zlibpython%d%d.azlibpython%d%d.dll.azlibpython%d.%d.dll.ar4r5ryr6TFr)r>r:r?r;r<r4rr5r%r&r+r~)rHrI�patternsrDrEZ
candidates�pat�filenameZstem_dirrG�fullnamer
r
r�_check_for_import_libes$r�cCs�t�\}}|rt�d|�dSt�}t�d||f�dttjdd��}tj	�
tjd|�}t||�dd|d|g}t
�|�dS)	N�)Skip building import library: "%s" existsz4Building import library (arch=AMD64): "%s" (from %s)�python%d%d.defr8ryrzr{r|)r�rrrLrr>r:r?r%r&r+r;rgrNZ
check_call)�
out_existsr�r�r�r�r�r
r
rr��s
�
r�cCs�t�\}}|rt�d|�dSdttjdd��}tj�tj	d|�}tj�
|�s�ttd�rptj�tjd|�}n"ttd�r�tj�tj
d|�}nd}tj�
|�r�|}nt�d	|�dSt�d
|�ddlm}d
ttjdd��}tj�tj	d|�}|j|j|gdd�}|�|�\}	}
t|d��"}|�|	|
|j|�Wd�n1�sL0Yt�}dd|d|d|g}
t�|
�}|�r�t�d�dS)z; Build the import libraries for Mingw32-gcc on Windows
    r�Nzpython%d%d.libr8ryr4r5r"z+Cannot build import library: "%s" not foundz(Building import library (ARCH=x86): "%s"r)�lib2defr�F)�shellrSrzz	--dllnamez--defz--output-libz:Failed to build import library for gcc. Linking will fail.)r�rrr>r:r?r%r&r+r;r~r<r4r5r]r�numpy.distutilsr�ZgetnmZ
DEFAULT_NMZparse_nmr^Z
output_defZ
DEF_HEADERrLrNrO)r�r�Zlib_nameZlib_fileZbase_libr�r�r�Z	nm_outputZdlist�flistZfidrkr��statusr
r
rr��sH


�2�

r��win32z8.0.50727.42Z80z9.0.21022.8Z90z10.0.30319.460Z100ZCRT_ASSEMBLY_VERSIONz(\d+)\.(\d)z9Cannot import msvcrt: using manifest will not be possiblecCsXztt|d|�}Wn$ty<td||f�d�Yn0t�d�}||||d�S)zUGiven a major and minor version of the MSVCR, returns the
    corresponding XML file.�
z)Version %d,%d of MSVCRT not supported yetNa�        <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
          <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
            <security>
              <requestedPrivileges>
                <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
              </requestedPrivileges>
            </security>
          </trustInfo>
          <dependency>
            <dependentAssembly>
              <assemblyIdentity type="win32" name="Microsoft.VC%(maj)d%(min)d.CRT" version="%(fullver)s" processorArchitecture="*" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
            </dependentAssembly>
          </dependency>
        </assembly>)�fullver�maj�min)�_MSVCRVER_TO_FULLVER�str�KeyErrorrC�textwrap�dedent)r�r�r��templater
r
r�msvc_manifest_xml�s��
r�rKcCs4|dkrd}n|dkrd}ntd|��d||fS)aWReturn the rc file used to generate the res file which will be embedded
    as manifest for given manifest file name, of given type ('dll' or
    'exe').

    Parameters
    ----------
    name : str
            name of the manifest file to embed
    type : str {'dll', 'exe'}
            type of the binary which will embed the manifest

    rKr8Zexer#zType %s not supportedz&#include "winuser.h"
%d RT_MANIFEST %s)rC)r}�typeZrctyper
r
r�manifest_rcs
�r�cCs.t�}|r*|t|�ks*tdt|�|f��dS)z6msver is the ms runtime version used for the MANIFEST.zKDiscrepancy between linked msvcr (%d) and the one about to be embedded (%d)N)rrZrC)�msverr�r
r
r�!check_embedded_msvcr_match_linked.s
��r�cCs&tj�|�dgd��}tj�|�dS)NZyo�cr)r%r&r*Z_gen_temp_sourcefiler')�configr,r
r
r�configtest_name:sr�cCst|�}|jj}||dS)Nz	.manifest)r�rZ
exe_extension)r�rlZexextr
r
r�
manifest_name>sr�cCst|�}|dS)Nr$)r�)r�rlr
r
r�rc_nameDsr�cCs�t�}|dur�|dkr�t|�t|��d�\}}tt|�t|��}tt|�d��*}|j�	t|��|�
|�Wd�n1s�0YdS)N��.rS)�get_build_msvc_versionr�r�rPr�rZr^r�Z
temp_filesrr_)r�r�Zma_strZmi_strZmanxmlZmanr
r
r�generate_manifestIsr�)F)rK):r3r%r@r:rN�rer�Znumpy.distutils.ccompilerZnumpyr�rZdistutils.cygwinccompilerrZdistutils.unixccompilerrZdistutils.msvccompilerrr�Zdistutils.errorsrZnumpy.distutils.misc_utilrrrr	r�compilerVrYrrr
rLrRrgrvrrr�r�r�r�Zmsvcrt�getattrZcrt_verrW�groupsr�r��ImportErrorr]r�r�r�r�r�r�r�r
r
r
r�<module>sb	


) 
;$B
 


Zerion Mini Shell 1.0