zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
U
O±d׀ã@sÌdZddlZddlZddlmZddlmZddlmZddl    m
Z
m Z m Z ddl mZddlmZdd    lmZdd
lmZdd lmZmZmZmZmZmZdd lmZdd lmZm Z Gdd„deƒZdS)zC Modified version of build_ext that handles fortran source files.
 
éN)Úglob)Ú newer_group)Ú    build_ext)ÚDistutilsFileErrorÚDistutilsSetupErrorÚDistutilsError)Ú    copy_file)Úlog)Úfilepath_from_subprocess_output)Ú combine_paths)Úfilter_sourcesÚget_ext_source_filesÚget_numpy_include_dirsÚhas_cxx_sourcesÚ has_f_sourcesÚ is_sequence)Úshow_fortran_compilers)Únew_ccompiler_optÚ CCompilerOptc@sœeZdZdZejdddddddgZejd    d
d efgZejd d gZdd„Z    dd„Z
dd„Z d"dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zd d!„Zd
S)#rz:build C/C++/F extensions (compile/link to build directory))z
fcompiler=Nz!specify the Fortran compiler type)z    parallel=Újznumber of parallel jobs)ú
warn-errorNz'turn all warnings into errors (-Werror))z cpu-baseline=Nz4specify a list of enabled baseline CPU optimizations)z cpu-dispatch=Nz.specify a list of dispatched CPU optimizations)údisable-optimizationNz1disable CPU optimized code(dispatch,simd,fast...))z
simd-test=NzMspecify a list of CPU optimizations to be tested against NumPy SIMD interfacezhelp-fcompilerNz list available Fortran compilersrrcCs8t |¡d|_d|_d|_d|_d|_d|_d|_dS©N)    Ú old_build_extÚinitialize_optionsÚ    fcompilerÚparallelÚ
warn_errorÚ cpu_baselineÚ cpu_dispatchÚdisable_optimizationÚ    simd_test©Úself©r$úXd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/distutils/command/build_ext.pyr4s
zbuild_ext.initialize_optionsc
CsÄ|jrDzt|jƒ|_Wn,tk
rB}ztdƒ|‚W5d}~XYnXt|jtƒr`|j tj¡|_|jphg}|j    jdkr~g|j    _|j    j|_|j 
|¡t   |¡|  ddddddd¡|jtjd    <dS)
Nz)--parallel/-j argument must be an integerÚbuild)rr)rr)rr)rr)r r )r!r!r!)rÚintÚ
ValueErrorÚ
isinstanceÚ include_dirsÚstrÚsplitÚosÚpathsepÚ distributionÚextendrÚfinalize_optionsÚset_undefined_optionsr!rZconf_target_groups)r#ÚeZ    incl_dirsr$r$r%r1>s,
 
 
 
úzbuild_ext.finalize_optionsc#    s¬ˆjs
dSˆ d¡ˆj ¡ržˆjrzˆjj d¡rJt d¡ˆj     d¡}qŽˆj     d¡}d|_| 
¡|  ¡dˆjjd<nˆ d¡ˆ  d¡}ˆj  |j¡nd}ddlm}ddlm}ˆj}||ˆjˆjˆjdˆ_ˆj ˆj¡ˆj ˆ¡ˆjrˆjj d    ¡ˆjj d    ¡ˆj ¡ˆjs¶tj  d
d d d ¡}tj  ˆ  d¡j!|¡}tj "tj  ˆj#d¡¡}t$ˆdƒr~ˆj% &¡t'ˆj|ˆj(ˆj)|dˆ_%dd„}ddl*}| +|ˆj%¡tj  ˆj#d¡ˆ_,tj -ˆj,¡sät .ˆj,¡i}    |dk    rZ|j/pügD]Z\}
} |
|    krN|    |
| krNt d|
t0|    |
ƒdd…t0| ƒdd…f¡| |    |
<qþˆjj/pfgD] \}
} |
|    kr~qh| |    |
<qht1ƒ} ˆjD]â} t1ƒ}g}g}g}| j/D]†}
|
|    kr|    |
}|| dg¡7}|| dg¡7}| dg¡D]}||krö| |¡qö|     |
i¡ dg¡D]}| 2|¡q&q´|rv| j/|}t 3d| j4| j/|f¡|| _/| j || _ |rœt 3d| j4|f¡| j5|| _5t6| j7ƒr²| 2d¡t8| j7ƒrÈ| 2d¡| j9p܈j :| j7¡}|rî| 2|¡d|krþd}nd}d}d |krd }d!}nd|kr,d}d!}| j9r:|rn|rh||krh| j9rht d"| j4||f¡|| _9|  ;|¡q–d | k}d| k}d| k}|ræ||ˆjˆjˆjdˆ_<ˆj<}|jˆj|d#| ˆ¡| ¡| =¡ˆ_<ndˆ_<|rpˆj>}|ˆj>ˆjˆjˆjdˆjd$ˆ_?ˆj?}|r6|j@}| ˆj¡|rZ| A¡rZ| ˆ¡| ¡nˆ d%|¡dˆ_?ndˆ_?|rúˆj>}|ˆj>ˆjˆjˆjd!ˆjd$ˆ_BˆjB}|rÀ|j@}| ˆj¡|rä| A¡rä| ˆ¡| ¡nˆ d&|¡dˆ_Bndˆ_Bˆ C¡‡fd'd(„ˆjDƒ}|D]†}tj  |d¡} ˆjsJtj  ˆjD| ¡} t Eˆj,¡D]L}!tj -| ¡srt .| ¡|! F¡ Gd)¡s†qVtj  ˆj,|!¡}"tH|"| ƒqVq dS)*NÚ    build_srcÚ
build_clibzMbuild_clib already run, it is too late to ensure in-place build of build_clibér)Ú new_compiler)Ú new_fcompiler)ÚcompilerÚverboseÚdry_runÚforcez-WerrorÚnumpyÚ    distutilsÚincludeznpy_cpu_dispatch_config.hzccompiler_opt_cache_ext.pyÚ compiler_opt)r9Údispatch_hpathrrÚ
cache_pathcSs t d¡t |jdd¡dS)Nz2
########### EXT COMPILER OPTIMIZATION ###########T)Úfull)r    ÚinfoÚreport)Zcoptr$r$r%rE¨s
zbuild_ext.run.<locals>.reportz.libszKlibrary %r defined more than once, overwriting build_info
%s... 
with
%s...i,Ú    librariesÚ library_dirsÚmacrosZsource_languagesz-updating extension %r libraries from %r to %rz-extending extension %r defined_macros with %rÚf77úc++ÚcFÚf90Tz.resetting extension %r language from %r to %r.)Zneed_cxx)r9r:r;r<Z
requiref90Z
c_compilerz!f77_compiler=%s is not available.z!f90_compiler=%s is not available.cs"h|]}ˆ |j¡ d¡d’qS)Ú.r)Úget_ext_fullnameÚnamer,)Ú.0Úextr"r$r%Ú    <setcomp>Ssÿz build_ext.run.<locals>.<setcomp>z.dll)IÚ
extensionsÚ run_commandr/Úhas_c_librariesÚinplaceÚhave_runÚgetr    ÚwarnÚget_command_objÚensure_finalizedÚrunÚget_finalized_commandrGÚappendr5Údistutils.ccompilerr7Znumpy.distutils.fcompilerr8r9r:r;r<Z    customizeZ customize_cmdrÚ compiler_soZshow_customizationr r-ÚpathÚjoinr4ÚabspathÚ
build_tempÚhasattrr@Z cache_flushrrrÚatexitÚregisterÚ extra_dll_dirÚisdirÚmakedirsrFÚreprÚsetÚaddrDrOÚ define_macrosrÚsourcesrÚlanguageZdetect_languageÚupdateÚ _cxx_compilerÚ cxx_compilerrÚ _f77_compilerÚ compiler_typeÚ get_versionÚ _f90_compilerZbuild_extensionsÚ    build_libÚlistdirÚlowerÚendswithr)#r#r5r7r8rurAZopt_cache_pathrErfZclibsÚlibnameZ
build_infoZ all_languagesrQZ ext_languagesZc_libsZ
c_lib_dirsrHZbinfoÚmÚlZ
new_c_libsZ ext_languageZ has_fortranZneed_f90_compilerZneed_f77_compilerZneed_cxx_compilerr9ÚctyperZ    pkg_rootsZpkg_rootZshared_lib_dirÚfnZ runtime_libr$r"r%r\`s€
 
 
ÿÿ
 
  ý 
ÿ 
ý 
$þ 
 
 
 
 
 ÿ ÿ  
 
 
 
 
 
 
ÿý
 û 
 
ÿû 
 
ÿ
þ
z build_ext.runcCs|Srr$)r#rorSr$r$r%Ú swig_sourcescszbuild_ext.swig_sourcesc1 sV|j}|dkst|ƒs$td|jƒ‚t|ƒ}|s4dS| |j¡}|jr”| d¡}d |dd…¡}|d}|     d¡}| 
|¡}t j  ||  |¡¡}    nt j  |j|  |¡¡}    ||j}
|j} |jsØ|j ¡sØt d¡d} | sút|
|    dƒsút d    |j¡dSt d
|j¡|jpg} t|d dƒp$g} t|d dƒp6g}|jdd…}|jD]}| |f¡qLt|jƒ\}}}}|jjd krœ|r|  d¡||7}g}|j dkr°|j!}n"|j dkrÄ|j"}n|j!pÐ|j"}|dk    rt#|dƒrô|j$pögng|_$t#|dƒr|j%pgng|_%|j&}|r<|dkr<t'd|jƒ‚|sH|r`|dkr`t'd|jƒ‚|j dkr†|dkr†| (d|j¡|j dkr¬|dkr¬| (d|j¡d|ji}|j)}|j*t+ƒ}g}g}g}g}|js„|     d¡j,}t j  ddd¡}t j  ||¡}| |¡|jr dn|} |f|df||f|dffD]8\}!}"‰|!D]&‰|"‡‡fd d!„ˆdd…Dƒ7}"qLq>|j -¡}n
| d"¡g}#|rÔt d#¡|#|jj.|f|| ||||j| ||d$œ|—Ž7}#|rt d%¡|#|jj.|f|| ||||j| | d&œ|—Ž7}#|rVt d'¡|#|jj/|f|||||j| || d(œ|—Ž7}#|r–t d)¡|#|j/|f|||||j| ||d(œ|—Ž7}#g}$g}%|rÒt d*¡|j0dd…}&t j  |j)t j  1|  |¡¡¡}'| 2|'¡|j3dkrøt4d+ƒ}(|$| 5|&|'¡7}$|%|j/||j)|||j|$|jd,7}%|j3dkrÒt4d+ƒD]’})|)|(krPq>t j  |'|)¡}*t j  6|)¡t j  6|*¡kr|q>t j  7|*¡r”t  8|*¡z| 9|)|'¡Wn(t:k
rÌt (d-|)|'f¡YnXq>|rt d.¡|%|j/||j)|||j|$|jd,7}%|%r"| ;|j¡s"|%}+|#},n g}+|#|%},|j<rB|, =|j<¡|j>pLg} | ?|¡dd…}-|j@dd…}.|jjA}/|jjd/krÐ| B||-|.¡|jCrì|jCD]&}0t4|0d0ƒD]})tD|)|jEƒq°q g|_Cn|j dkrì|dk    rì|jA}/|j dkr|dk    r|jA}/|dk    r(| F|,|-||.|+¡\},}-|/|,|    |-|.|jC| | G|¡|j|j)|j d1
dS)2Nzjin 'ext_modules' option (extension '%s'), 'sources' must be present and must be a list of source filenamesrMréÿÿÿÿÚbuild_pyz*Detected changes on compiler optimizationsTÚnewerz$skipping '%s' extension (up-to-date)zbuilding '%s' extensionZextra_c_compile_argsZextra_cxx_compile_argsÚmsvcz/Zm1000rLrIÚextra_f77_compile_argsÚextra_f90_compile_argsz5extension %r has C++ sourcesbut no C++ compiler foundz>extension %r has Fortran sources but no Fortran compiler found)rIrLzTextension %r has Fortran libraries but no Fortran linker found, using default linkerrJzLextension %r has C++ libraries but no C++ linker found, using default linkerÚdependsr4r=r>r?)z .dispatch.c)z .dispatch.cppz .dispatch.cxxcs&g|]}| ˆ¡rˆ ˆ |¡¡‘qSr$)r{ÚpopÚindex)rPÚs©Z_extZ_srcr$r%Ú
<listcomp>Ós
ÿz-build_ext.build_extension.<locals>.<listcomp>)ZNPY_DISABLE_OPTIMIZATIONr6z#compiling C++ dispatch-able sources)Ú
output_dirÚsrc_dirrHr*ÚdebugÚextra_postargsZ    ccompilerz!compiling C dispatch-able sources)rŽrrHr*rr‘zcompiling C sources)rŽrHr*rr‘zcompiling C++ sourcesz#compiling Fortran 90 module sourcesz*.mod)rŽrHr*rr‘rˆzfailed to move %r to %rzcompiling Fortran sources)r…ZintelwZintelemwz/*.dll)rFrGÚruntime_library_dirsr‘Úexport_symbolsrrdZ target_lang)HrorrrOÚlistrNrVr,rbr]Zget_package_dirr-raÚget_ext_filenamerxrˆr<r r@Z    is_cachedr    rrrDÚextra_compile_argsÚgetattrrnÚ undef_macrosr^r r9rurprwrtrer†r‡rrrrYrdr*rr4Zcpu_baseline_flagsZ try_dispatchÚcompileÚ module_dirsÚdirnameÚmkpathZmodule_dir_switchrZmodule_optionsrcÚisfileÚremoveÚ    move_filerZcan_ccompiler_linkÚ extra_objectsr0Úextra_link_argsZ get_librariesrGZlink_shared_objectÚ_libs_with_msvc_and_fortranr’rrhÚ_process_unlinkable_fobjectsZget_export_symbols)1r#rQroÚfullnameÚmodpathÚpackageÚbaserƒÚ package_dirZ ext_filenamerˆZ force_rebuildÚ
extra_argsZ extra_cflagsZextra_cxxflagsrHZundefÚ    c_sourcesZ cxx_sourcesZ    f_sourcesZfmodule_sourcesrrsÚkwsrŽr*Zcopt_c_sourcesZcopt_cxx_sourcesZcopt_baseline_flagsZ copt_macrosZbsrc_dirrAZcopt_build_srcZ_srcsZ_dstZ    c_objectsr‘Z    f_objectsršZmodule_build_dirZexisting_modulesÚfÚtÚunlinkable_fobjectsÚobjectsrFrGZlinkerÚdr$rŒr%Úbuild_extensiongsþÿ 
 
 
ÿ
ÿ
 
 
ÿ
 
 
ÿÿÿÿÿÿÿÿ
 
 
ÿþ
þ 
 
ÿø    ÷ 
ÿùø    
ÿÿúø    
ÿÿúø
 
ÿÿ
 ÿú  
 
ÿ
ú  ÿ
 
ýøzbuild_ext.build_extensioncCsP| d¡j}| d¡j}|jjtj |d¡g|jd}|jj    |d||j
ddS)Nr4r5zgfortran_vs2003_hack.c)rŽZ_gfortran_workaround)rŽr) r]r4r5r9r™r-rarbrdZcreate_static_libr)r#rªr4r5r¯r$r$r%Ú_add_dummy_mingwex_symjs  ÿþÿz build_ext._add_dummy_mingwex_symc Csöt|ƒ}t|ƒ}t|ƒ}|dd…D]˜}|D]Ž}tj ||d¡}tj |¡r,| |¡t|dƒ}    | |     ¡     ¡¡W5QRXtj ||d¡}
t|
dƒ}    | |     ¡     ¡¡W5QRXq,q$|rîdd„|Dƒ} |j
| |j |j d} | | ¡||fS)Nz    .fobjectsÚrz    .cobjectscSsg|]}tj |¡‘qSr$)r-rarc)rPÚobjr$r$r%rŽsz:build_ext._process_unlinkable_fobjects.<locals>.<listcomp>)rŽrh) r”r-rarbrržÚopenr0ÚreadÚ
splitlinesZwrap_unlinkable_objectsrdrh) r#r¯rFrrGr®ÚlibÚlibdirZfake_libr¬Zc_libZfobjectsÚwrappedr$r$r%r£ss, 
   þ
z&build_ext._process_unlinkable_fobjectsc
CsÒ|dkr dS|D]Î}| d¡r qd}|p*gD]*}tj |d|¡}tj |¡r,d}qXq,|r^qd}|D]^}tj |d|¡}tj |¡rftj |j|d¡}t||ƒ|j|kr¼| |j¡d}qÆqf|rÌqt     d||f¡qg}    |j
D]T}
|
 d¡r4zt   d    d
|
g¡}
Wnt t jfk
r*Yn
Xt|
ƒ}
|     |
¡qê| |    ¡|jD]|} |  d¡sP| | ¡t|    d | d ƒ} | rPtj |j| d¡} tj | ¡s²t| d | ƒ|j|krP| |j¡qPdS)Nr…Fz%s.libTzlib%s.az.libz+could not find library %r in directories %sz/usr/libZcygpathz-wr¸z.ar)Ú
startswithr-rarbrrdrr^r    rYrGÚ
subprocessÚ check_outputÚOSErrorÚCalledProcessErrorr
r0rFr )r#rZ c_librariesZc_library_dirsr|Z
fileexistsr¹ZlibfileZlibfile2Z
f_lib_dirsÚdirr¸ÚpÚdst_namer$r$r%r¢–s`
 
 
 ÿ
 
 
 
 z%build_ext._libs_with_msvc_and_fortrancCs.| |j¡g}|jD]}| t|ƒ¡q|Sr)Úcheck_extensions_listrSr0r )r#Ú    filenamesrQr$r$r%Úget_source_filesÓs
 
zbuild_ext.get_source_filesc    CsP| |j¡g}|jD]4}|js"q| |j¡}| tj |j    | 
|¡¡¡q|Sr) rÃrSrorNrOr^r-rarbrxr•)r#ÚoutputsrQr¤r$r$r%Ú get_outputsÚs 
 ÿzbuild_ext.get_outputs)N)Ú__name__Ú
__module__Ú __qualname__Ú descriptionrÚ user_optionsÚ help_optionsrÚboolean_optionsrr1r\rr±r²r£r¢rÅrÇr$r$r$r%rs<óÿÿ
"
    #=r)!Ú__doc__r-r¼rÚdistutils.dep_utilrZdistutils.command.build_extrrÚdistutils.errorsrrrÚdistutils.file_utilrZnumpy.distutilsr    Znumpy.distutils.exec_commandr
Znumpy.distutils.system_infor Znumpy.distutils.misc_utilr r rrrrZ'numpy.distutils.command.config_compilerrZnumpy.distutils.ccompiler_optrrr$r$r$r%Ú<module>s