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
U
O±d÷Lã@sædZddlZddlmZddlZddlmZddlmZm    Z    m
Z
ddl m Z ddl mZddlmZmZmZmZmZmZdd    lmZejZeeeƒƒD]:Zeedd
kr–eedd feed d…ee<q–Gd d„deƒZdS)zC Modified version of build_clib that handles fortran source files.
éN)Úglob)Ú
build_clib)ÚDistutilsSetupErrorÚDistutilsErrorÚDistutilsFileError)Úlog)Ú newer_group)Úfilter_sourcesÚget_lib_source_filesÚget_numpy_include_dirsÚhas_cxx_sourcesÚ has_f_sourcesÚ is_sequence)Únew_ccompiler_opt)z
build-clibz
build-tempú=éc@s€eZdZdZejdddddddgZejd    d
d gZd d „Zdd„Zdd„Z    dd„Z
dd„Z dd„Z dd„Z dd„Zdd„ZdS)rz1build C/C++/F libraries used by Python extensions)z
fcompiler=Nz!specify the Fortran compiler type)ÚinplaceÚizBuild in-place)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...)rrrcCs8t |¡d|_d|_d|_d|_d|_d|_d|_dS)Nr)    Úold_build_clibÚinitialize_optionsÚ    fcompilerrÚparallelÚ
warn_errorÚ cpu_baselineÚ cpu_dispatchÚdisable_optimization)Úself©r úYd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/distutils/command/build_clib.pyr1s
zbuild_clib.initialize_optionsc
Csf|jrDzt|jƒ|_Wn,tk
rB}ztdƒ|‚W5d}~XYnXt |¡| dddddd¡dS)Nz)--parallel/-j argument must be an integerÚbuild)rr)rr)rr)rr)rr)rÚintÚ
ValueErrorrÚfinalize_optionsÚset_undefined_options)rÚer r r!r%<s
ûzbuild_clib.finalize_optionscCs*|jD]\}}t| dg¡ƒrdSqdS©NÚsourcesTF)Ú    librariesr Úget©rÚlib_nameÚ
build_infor r r!Úhave_f_sourcesKszbuild_clib.have_f_sourcescCs*|jD]\}}t| dg¡ƒrdSqdSr()r*r r+r,r r r!Úhave_cxx_sourcesQszbuild_clib.have_cxx_sourcescCsT|js
dSg}| d¡|jD]*\}}| dd¡}|r||kr| |¡qddlm}||j|j|jd|_|jj    |j
|  ¡d|j r¤|jj d¡|jj  d¡|j}d|_|j |¡||_|j ¡|jsbtj dd    d
d ¡}tj | d¡j|¡}tj tj |jd ¡¡}t|d ƒr*|j ¡t|j||j|j|d|_dd„}    ddl}
|
 |    |j¡|  ¡ràddl!m"} | |j#|j$|j|jd|k|jd|_%|j%dk    ræ|j%     |j
¡|j}d|_|j% |¡||_|j% ¡nd|_%| &|j¡|j'rP|j
j(D]L}|j )|j*¡} tj |j+| ¡} tj |j,| ¡}| -|j,¡t. /| |¡qdS)NÚ    build_srcÚlanguager)Ú new_compiler)ÚcompilerÚdry_runÚforce)Zneed_cxxz-WerrorÚnumpyÚ    distutilsÚincludeznpy_cpu_dispatch_config.hzccompiler_opt_cache_clib.pyÚ compiler_opt)r4Údispatch_hpathrrÚ
cache_pathcSs t d¡t |jdd¡dS)Nz3
########### CLIB COMPILER OPTIMIZATION ###########T)Úfull)rÚinfoÚreport)Zcoptr r r!r?Œs
zbuild_clib.run.<locals>.report©Ú new_fcompilerÚf90©r4Úverboser5r6Ú
requiref90Z
c_compiler)0r*Ú run_commandr+ÚappendÚdistutils.ccompilerr3r4r5r6Ú    customizeÚ distributionr0rÚ compiler_soZ customize_cmdZshow_customizationrÚosÚpathÚjoinÚget_finalized_commandr1ÚabspathÚ
build_tempÚhasattrr:Z cache_flushrrrÚatexitÚregisterr/Únumpy.distutils.fcompilerrArrDÚ _f_compilerÚbuild_librariesrZinstalled_librariesÚlibrary_filenameÚnamerÚ
target_dirÚmkpathÚshutilÚcopy)rÚ    languagesr-r.Úlr3r*r;Zopt_cache_pathr?rSrAÚlibnameÚsourceÚtargetr r r!ÚrunWs†
    þ
ÿ 
ÿ 
ý
 û      zbuild_clib.runcCs.| |j¡g}|jD]}| t|ƒ¡q|S©N)Zcheck_library_listr*Úextendr
)rÚ    filenamesÚlibr r r!Úget_source_files±s
 
zbuild_clib.get_source_filescCs |D]\}}| |||¡qdSrd)Úbuild_a_library)rr*r-r.r r r!rW¸s zbuild_clib.build_librariescCs>|dkr gSg}|D]$}t|ƒr.|||ƒ7}q| |¡q|S)ah Assemble flags from flag list
 
        Parameters
        ----------
        in_flags : None or sequence
            None corresponds to empty list.  Sequence elements can be strings
            or callables that return lists of strings. Callable takes `self` as
            single parameter.
 
        Returns
        -------
        out_flags : list
        N)ÚcallablerG)rZin_flagsZ    out_flagsZin_flagr r r!Úassemble_flags¼s zbuild_clib.assemble_flagsc0 sè|j}|j}| d¡}|dks&t|ƒs2td|ƒ‚t|ƒ}t|ƒ\}}}    }
|
p`| dd¡dk} g} |rt|  d¡|r‚|  d¡| r’|  d¡n|    r |  d¡| |d<|j||j    d    } || d
g¡}|j
}|j sì|j   ¡sìt d ¡d }|st|| d ƒst d|¡dSt d|¡| di¡}|dk    r¤|r¤t d|f¡ddlm}||j|j|j|j
| |jd}|dk    r¤|j}| d¡ ¡}| |¡| |¡|    s°|
rÆ|dkrÆtd|ƒ‚|dk    rô| d¡pÞg|_| d¡pðg|_| d¡}|dkr g}| d¡}|dkr$g}| | d¡¡}| | d¡¡}| | d¡¡}|  t!ƒ¡| d¡png}t"j# $| ¡}| rŒ| %|¡|jdkr¤||7}g}g}g}g}g}|j s`| &d¡j'}t"j# (d d!d"¡} t"j# (|| ¡} | | ¡|j)rüdn|}!|f|d#f||f|d$ffD]8\}"}#‰|"D]&‰|#‡‡fd%d&„ˆdd…Dƒ7}#q(q|j  *¡}n
| d'¡g}$|rªt d(¡|$|j j+||j,|!||||j|||%d)7}$|rät d*¡|$|j j+||j,|!||||j||d+7}$|rt d,¡|$|j-||j,||||j|||d-7}$|rft d.¡| .¡}%|%j-||j,||||j|||d-}&|$  |&¡|    sr|
r²g}g}'| r¤|j/dkr”t0d/ƒ}(|| 1||¡7}|
rÒt d0¡|'|j-|
|j,|||j|d-7}'| r‚|jj/dkr‚t0d/ƒD]’})|)|(krqît"j# (||)¡}*t"j# 2|)¡t"j# 2|*¡kr,qît"j# 3|*¡rDt" 4|*¡z| 5|)|¡Wn(t6k
r|t 7d1|)|f¡YnXqî|    r¶t d2¡|'|j-|    |j,|||j|d-7}'ng}'|'r~| 8|¡s~t"j# (|j    |d3¡}+t9|+d4ƒ })|) :d5 (d6d7„|'Dƒ¡¡W5QRXt"j# (|j    |d8¡}+t9|+d4ƒ })|) :d5 (d9d7„|$Dƒ¡¡W5QRXt"j# (|j    ||j;¡},t9|,d:ƒ})W5QRXn |$  |'¡|j<|$||j    |jd;| d<g¡}-|D]&\}.}/|.|-kr®|-  |/ d<g¡¡q®|-rä|-|d<<dS)=Nr)zfin 'libraries' option (library '%s'), 'sources' must be present and must be a list of source filenamesr2ÚcrBzc++Zf77Úsource_languages)Ú
output_dirÚdependsz*Detected changes on compiler optimizationsTÚnewerz"skipping '%s' library (up-to-date)zbuilding '%s' libraryÚ    config_fczEusing additional config_fc from setup script for fortran compiler: %srr@rCz<library %s has Fortran sources but no Fortran compiler foundÚextra_f77_compile_argsÚextra_f90_compile_argsÚmacrosÚ include_dirsZextra_compiler_argsÚ extra_cflagsÚextra_cxxflagsÚ module_dirsZmsvcr1r7r8r9)z .dispatch.c)z .dispatch.cppz .dispatch.cxxcs&g|]}| ˆ¡rˆ ˆ |¡¡‘qSr )ÚendswithÚpopÚindex)Ú.0Ús©Z_extZ_srcr r!Ú
<listcomp>Js
ÿz.build_clib.build_a_library.<locals>.<listcomp>)ZNPY_DISABLE_OPTIMIZATIONrz#compiling C++ dispatch-able sources)rnÚsrc_dirrtruÚdebugÚextra_postargsZ    ccompilerz!compiling C dispatch-able sources)rnr€rtrurr‚zcompiling C sources)rnrtrurr‚zcompiling C++ sourcesz*.modz#compiling Fortran 90 module sourceszfailed to move %r to %rzcompiling Fortran sourcesz    .fobjectsÚwÚ
css|]}tj |¡VqdSrd©rLrMrP©r|Úobjr r r!Ú    <genexpr>ºsz-build_clib.build_a_library.<locals>.<genexpr>z    .cobjectscss|]}tj |¡VqdSrdr…r†r r r!rˆ¿sÚwb)rnrr*)=r4rVr+rrÚlistr    rGrXrr6rr:Z    is_cachedrrrr>rUrAÚ compiler_typerDr5rJÚget_option_dictr]ÚupdaterIrrrrsrkrer rLrMÚdirnamer[rOr1rNrZcpu_baseline_flagsZ try_dispatchrQÚcompileÚ cxx_compilerZmodule_dir_switchrZmodule_optionsrPÚisfileÚremoveÚ    move_filerÚwarnZcan_ccompiler_linkÚopenÚwriteZstatic_lib_extensionZcreate_static_lib)0rr.r-r*r4rr)Z    c_sourcesZ cxx_sourcesZ    f_sourcesZfmodule_sourcesrErmZlib_fileroZ force_rebuildrqrAÚdistZbase_config_fcrtrur‚rvrwrxZmodule_build_dirZcopt_c_sourcesZcopt_cxx_sourcesZcopt_baseline_flagsZ copt_macrosZbsrc_dirr;Zcopt_build_srcZ_srcsZ_dstZobjectsrZ cxx_objectsZ    f_objectsZexisting_modulesÚfÚtZlistfnZ    lib_fnameZclib_librariesÚlnameZbinfor r~r!riÔsÚ
þÿ
ÿ
 
 
ÿ
   þ û
 
 
ÿ
ÿÿÿÿ
 
 
 
ÿÿÿ  
 
 
ÿþ
þ 
 
ø 
ù    
ÿþú
 
ÿþú    
  ÿ
û 
 
ÿ
û
 
ÿ $
ÿ $
ÿ  
þ  
zbuild_clib.build_a_libraryN)Ú__name__Ú
__module__Ú __qualname__Ú descriptionrÚ user_optionsÚboolean_optionsrr%r/r0rcrhrWrkrir r r r!rs,ôÿ Zr)Ú__doc__rLrr\Zdistutils.command.build_clibrrÚdistutils.errorsrrrZnumpy.distutilsrÚdistutils.dep_utilrZnumpy.distutils.misc_utilr    r
r r r rZnumpy.distutils.ccompiler_optrrŸZ_lÚrangeÚlenZ_ir r r r!Ú<module>s      (