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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
U
O±d qã@s®ddlZddlZddlZddlZddlZddlZddlmZddlmZddl    m
Z
m Z m Z m Z mZddlmZmZmZmZmZddlmZddlmZddlmZdd    lmZmZdd
lmZm Z m!Z!m"Z"m#Z#m$Z$ddl%Z%da&e% '¡Z(e)ƒZ*d d „Z+d d„Z,dd„Z-e,ede-ƒdMdd„Z.e,ede.ƒdNdd„Z/e,ede/ƒdOdd„Z0e,ede0ƒdPdd„Z1e,ede1ƒd d!„Z2d"d#„Z3e,ed$e3ƒdQd%d&„Z4e,ed'e4ƒdRd)d*„Z5d+dgfd,d-„Z6e,ed.e6ƒd/d0„Z7e,ed1e7ƒd2e
d3<d4e
d5<d6e
d7<d8e
d9<d:e
d;<d<e
d=<d>e
d?<ej8d@7_8ej9dAkrNdBe
dC<e!ƒrNe :dD¡dEej8e_8e Z;dSdFdG„Z e e_ e Z<dHdI„Z e e_ dJD]0Z=ej> ?dKe=dL¡Z@e@dk    rxeAe@dIe ƒqxdS)TéN)Úcopy)Ú    ccompiler)Úcompiler_classÚgen_lib_optionsÚget_default_compilerÚ new_compilerÚ    CCompiler)ÚDistutilsExecErrorÚDistutilsModuleErrorÚDistutilsPlatformErrorÚ CompileErrorÚUnknownFileError)Úcustomize_compiler)Ú LooseVersion)Úlog)Úfilepath_from_subprocess_outputÚforward_bytes_to_stdout)Ú    cyg2win32Ú is_sequenceÚmingw32Úget_num_build_jobsÚ_commandline_dep_stringÚsanitize_cxx_flagsc     CsÎ|d}tj |¡sdSt|dƒ}| ¡}W5QRXt|||ƒ}|d}||krVdSd |dd…¡}    dd„tj|    dd    Dƒ}
z2t     |¡j
} |
D]}t     |¡j
| kr’WdSq’Wnt k
rÈYdSXd
S) z®
    Check if an objects needs to be rebuild based on its dependencies
 
    Parameters
    ----------
    obj : str
        object file
 
    Returns
    -------
    bool
    ú.dTÚréÿÿÿÿÚNcSs"g|]}|dkr| d¡s|‘qS)Ú
ú:)Úendswith)Ú.0Úx©r"úPd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/distutils/ccompiler.pyÚ
<listcomp>Es
ÿz _needs_build.<locals>.<listcomp>)ÚposixF) ÚosÚpathÚexistsÚopenÚ    readlinesrÚjoinÚshlexÚsplitÚstatÚst_mtimeÚOSError) ÚobjÚcc_argsÚextra_postargsÚpp_optsZdep_fileÚfÚlinesZcmdlineZ last_cmdlineÚcontentsÚdepsZt_objr"r"r#Ú _needs_build%s&    r9cs‡fdd„}t|||ƒdS)Ncsˆ|f|ž|ŽS©Nr")ÚselfÚargsÚkw©Úfuncr"r#Ú<lambda>Yóz replace_method.<locals>.<lambda>)Úsetattr)ÚklassÚ method_namer?Úmr"r>r#Úreplace_methodWs rFcCsdS)zÐ
    Does nothing here, but is called by the get_version method and can be
    overridden by subclasses. In particular it is redefined in the `FCompiler`
    class where more documentation can be found.
 
    Nr"©r;r"r"r#ÚCCompiler_find_executablesbsrHÚfind_executablesc     Cs^|dk    r |nttjƒ}|dkr8|}t|ƒr8d t|ƒ¡}t |¡z,|jrZt    j
||dnt    j
|t    j |dWn”t    j k
rž}z|j }|j}W5d}~XYnjtk
r}zFd|›d}z| tjj¡}Wntk
rì| d¡}YnXd}W5d}~XYnXdSt|ƒr d t|ƒ¡}|jr0t|ƒt d    |¡rDd
}nd }td |||fƒ‚dS) aê
    Execute a command in a sub-process.
 
    Parameters
    ----------
    cmd : str
        The command to execute.
    display : str or sequence of str, optional
        The text to add to the log file kept by `numpy.distutils`.
        If not given, `display` is equal to `cmd`.
    env : a dictionary for environment variables, optional
 
    Returns
    -------
    None
 
    Raises
    ------
    DistutilsExecError
        If the command failed, i.e. the exit status was not 0.
 
    Nú )Úenv)ÚstderrrKz
 
z
 
 
Úutf8ésToo many open filesz2
Try rerunning setup command until build succeeds.rz)Command "%s" failed with exit status %d%s)Údictr&Úenvironrr+ÚlistrÚinfoÚverboseÚ
subprocessÚ check_outputÚSTDOUTÚCalledProcessErrorÚoutputÚ
returncoder0ÚencodeÚsysÚstdoutÚencodingÚAttributeErrorrÚreÚsearchr    )    r;ÚcmdÚdisplayrKÚexcÚoÚsÚeÚmsgr"r"r#ÚCCompiler_spawnps>
 
ÿrhÚspawnrc Csê|dkr d}g}|D]Ð}tj tj |¡¡\}}tj |¡d}|tj |¡d…}| d¡rœ| d¡d}|d|…}    tj tj     |    ¡¡}    |    ||d…}||j
kr¶t d||fƒ‚|rÆtj |¡}tj  |||j ¡}
| |
¡q|S)aÞ
    Return the name of the object files for the given source files.
 
    Parameters
    ----------
    source_filenames : list of str
        The list of paths to source files. Paths can be either relative or
        absolute, this is handled transparently.
    strip_dir : bool, optional
        Whether to strip the directory from the returned paths. If True,
        the file name prepended by `output_dir` is returned. Default is False.
    output_dir : str, optional
        If given, this path is prepended to the returned paths to the
        object files.
 
    Returns
    -------
    obj_names : list of str
        The list of paths to the object files corresponding to the source
        files in `source_filenames`.
 
    Nréz..éz"unknown file type '%s' (from '%s'))r&r'ÚsplitextÚnormpathÚ
splitdriveÚisabsÚ
startswithÚrfindÚbasenameÚabspathZsrc_extensionsr r+Z obj_extensionÚappend) r;Zsource_filenamesZ    strip_dirÚ
output_dirZ    obj_namesÚsrc_nameÚbaseÚextÚiÚdZobj_namer"r"r#ÚCCompiler_object_filenames¹s&
 
  r{Zobject_filenamesc        sHtƒ}    ttdkrt |    ¡aW5QRX|s0gSddlm}
m} m} t    ˆ|
ƒr˜g} dD]4}t
ˆd|ƒ}|dkrrqV|   d|d  |¡f¡qVd  | ¡} nˆj }d    d  |¡f} t | ¡ˆ |||||ˆ¡\}}‰‰}ˆ ˆ||¡‰d
d  ˆ¡} ˆr
| d d  ˆ¡7} t | ¡‡‡‡‡fd d „}t    ˆ|
ƒrÚt| ¡ƒ}gg}}|D]r}||krL||\}}ˆjdkr‚t|ƒ}t|ƒ}| |ƒrª| |ƒsª|  |||ff¡n|  |||ff¡qL|}|D]}||ƒqÈn| ¡}t|ƒdkr0|    dkr0ddlm}||    ƒ}| ||¡}W5QRXt|ƒn|D]}||ƒq4|S)aÁ
    Compile one or more source files.
 
    Please refer to the Python distutils API reference for more details.
 
    Parameters
    ----------
    sources : list of str
        A list of filenames
    output_dir : str, optional
        Path to the output directory.
    macros : list of tuples
        A list of macro definitions.
    include_dirs : list of str, optional
        The directories to add to the default include file search path for
        this compilation only.
    debug : bool, optional
        Whether or not to output debug symbols in or alongside the object
        file(s).
    extra_preargs, extra_postargs : ?
        Extra pre- and post-arguments.
    depends : list of str, optional
        A list of file names that all targets depend on.
 
    Returns
    -------
    objects : list of str
        A list of object file names, one per source file `sources`.
 
    Raises
    ------
    CompileError
        If compilation fails.
 
    Nr)Ú    FCompilerÚ    is_f_fileÚhas_f90_header)Zf77Zf90ZfixZ    compiler_zFortran %s compiler: %srJrzC compiler: %s
zcompile options: '%s'z
extra options: '%s'cs¢|\}\}}t|ˆˆˆƒsdSt$|tkrBt |¡W5QR£qXW5QRXt d¡qz(tˆ |||ˆˆˆ¡W5QRXW5tt |¡W5QRXXdS)Ngš™™™™™¹?)    r9Ú _global_lockÚ_processing_filesÚaddÚtimeÚsleepÚremoveÚ_job_semaphoreÚ_compile)r<r1Úsrcrx©r2r3r4r;r"r#Úsingle_compile1s 
 "z)CCompiler_compile.<locals>.single_compileZabsoftrj)ÚThreadPoolExecutor)rrr…Ú    threadingÚ    SemaphoreZnumpy.distutils.fcompilerr|r}r~Ú
isinstanceÚgetattrrtr+Ú compiler_sorrRZ_setup_compileZ _get_cc_argsrQÚkeysÚ compiler_typerÚitemsÚlenÚconcurrent.futuresrŠÚmap)r;ÚsourcesruÚmacrosÚ include_dirsÚdebugÚ extra_preargsr3ÚdependsÚjobsr|r}r~rbZfcZfcompZccompZobjectsÚbuildr‰Zobjects_to_buildZ f77_objectsZ other_objectsr1r‡rxZ build_itemsrdrŠÚpoolÚresr"rˆr#ÚCCompiler_compileèsj(
 
 ÿÿ 
 
 
 
 
 r Úcompiler"cst d|jjˆjjf¡t|dƒrJd|jdkrJ|j d¡|j d¡‡‡fdd„}|dƒrl| ˆj    ¡|d    ƒrˆj
D]\}}|  ||¡qz|d
ƒr®ˆj D]}|  |¡qž|d ƒrÈ| |jˆj¡|d ƒrâ| |jˆj¡|d ƒrö| ˆj¡|dƒr | ˆj¡dS)aã
    Customize compiler using distutils command.
 
    Parameters
    ----------
    cmd : class instance
        An instance inheriting from `distutils.cmd.Command`.
    ignore : sequence of str, optional
        List of `CCompiler` commands (without ``'set_'``) that should not be
        altered. Strings that are checked for are:
        ``('include_dirs', 'define', 'undef', 'libraries', 'library_dirs',
        'rpath', 'link_objects')``.
 
    Returns
    -------
    None
 
    zcustomize %s using %sÚcompilerÚclangrz-ftrapping-mathcstˆ|dƒdk    o|ˆkSr:)rŽ)Úattr©raÚignorer"r#Úallowsz&CCompiler_customize_cmd.<locals>.allowr˜ÚdefineÚundefÚ    librariesÚ library_dirsÚrpathÚ link_objectsN)rrRÚ    __class__Ú__name__Úhasattrr¢rtrZset_include_dirsr˜r¨Z define_macror©Zundefine_macroZ set_librariesrªZset_library_dirsr«Zset_runtime_library_dirsr¬Zset_link_objectsr­)r;rar¦r§ÚnameÚvalueÚmacror"r¥r#ÚCCompiler_customize_cmdts. ÿ   
 
r´Z customize_cmdcs g}d}t|j ¡ƒ}dD]}||kr| |¡q|D]8}t||ƒr6t||ƒ}t|t|ƒƒ}| |t|ƒf¡q6dt|dƒd‰‡fdd„|Dƒ}d     |¡S)    Nr)
Úversionrªr«Z object_switchZcompile_switchr˜r¨r©r¬r­z%-rjzs = %scsg|] }ˆ|‘qSr"r")r Úprop©Úfmtr"r#r$µsz'_compiler_to_string.<locals>.<listcomp>r)
rQZ executablesrrtr°rŽÚmaxr“Úreprr+)r¢ÚpropsZmxrÚkeyÚvr6r"r·r#Ú_compiler_to_string¦s 
 
r¾cCsXz | ¡Wntk
r YnXtjjdkrTtdƒt|jƒtt|ƒƒtdƒdS)z×
    Print the compiler customizations to stdout.
 
    Parameters
    ----------
    None
 
    Returns
    -------
    None
 
    Notes
    -----
    Printing is only done if the distutils log threshold is < 2.
 
    rkzP********************************************************************************N)Ú get_versionÚ    ExceptionrÚ _global_logÚ    thresholdÚprintr®r¾rGr"r"r#ÚCCompiler_show_customization¸s  
 rÄZshow_customizationc
    CsÖt d|jj¡t|ƒ|ræz|j d¡Wnttfk
rFYnXt    |dƒr®d|j
dkr®|j sæ|j
d  d¡r€d\}}nd\}}|j
d  ||¡g|j
d    d
…|_ n8t    |dƒrÊt d |j
f¡t    |d ƒsæt d |jj¡t    |dƒr*d|j
dks"d|j
dks"d|j
dkr*d|_n¨tjdkrÒdd
l}dd
l}| ¡}zvzTtj |d¡}t|dƒ}    |     d¡W5QRX|j|g|dd|dgdd|_Wntk
rÀd|_YnXW5| |¡Xd
S)am
    Do any platform-specific customization of a compiler instance.
 
    This method calls `distutils.sysconfig.customize_compiler` for
    platform-specific customization, as well as optionally remove a flag
    to suppress spurious warnings in case C++ code is being compiled.
 
    Parameters
    ----------
    dist : object
        This parameter is not used for anything.
    need_cxx : bool, optional
        Whether or not C++ has to be compiled. If so (True), the
        ``"-Wstrict-prototypes"`` option is removed to prevent spurious
        warnings. Default is False.
 
    Returns
    -------
    None
 
    Notes
    -----
    All the default options used by distutils can be extracted with::
 
      from distutils import sysconfig
      sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
                                'CCSHARED', 'LDSHARED', 'SO')
 
    z customize %sz-Wstrict-prototypesr¢ÚccrÚgcc)rÆúg++)rÅzc++rjNz#### %s #######Ú compiler_cxxzMissing compiler_cxx fix for rÇr£Tr%zfile.cÚwzint a;
z-MMDz-MFr)ruršF)rrRr®r¯rrr„r^Ú
ValueErrorr°r¢rÈrpÚreplaceÚwarnZ _auto_dependsr&r±ÚtempfileÚshutilÚmkdtempÚrmtreer'r+r)Úwriter¡r )
r;ÚdistZneed_cxxÚaÚbrÍrÎZtmpdirÚfnr5r"r"r#ÚCCompiler_customizeÕsR
 ÿ
 
 ÿ þ  
 ÿ
 rÖZ    customizeú[-.\d]+cs‡‡‡fdd„}|S)aU
    Simple matching of version numbers, for use in CCompiler and FCompiler.
 
    Parameters
    ----------
    pat : str, optional
        A regular expression matching version numbers.
        Default is ``r'[-.\d]+'``.
    ignore : str, optional
        A regular expression matching patterns to skip.
        Default is ``''``, in which case nothing is skipped.
    start : str, optional
        A regular expression matching the start of where to start looking
        for version numbers.
        Default is ``''``, in which case searching is started at the
        beginning of the version string given to `matcher`.
 
    Returns
    -------
    matcher : callable
        A function that is appropriate to use as the ``.version_match``
        attribute of a `CCompiler` class. `matcher` takes a single parameter,
        a version string.
 
    csz| dd¡}d}ˆr0t ˆ|¡}|s(dS| ¡}t ˆ||d…¡}|sLdSˆrpt ˆ| d¡¡rp| ¡}q0qpq0| d¡S)NrrJr)rËr_ÚmatchÚendr`Úgroup)r;Úversion_stringÚposrE©r¦ÚpatÚstartr"r#ÚmatcherBs  z%simple_version_match.<locals>.matcherr")rÞr¦rßràr"rÝr#Úsimple_version_match(sráFc     s:|st|dƒr|jS| ¡z
|j}Wntk
r<YdSX|rJ|dsNdSz
|j}WnDtk
rœz
|j‰Wntk
rŠYYdSX‡fdd„}YnXztj|tj    d}WnLtj
k
râ}z|j }|j }W5d}~XYn*t k
rþd}d}YnXt|ƒ}d}d}||kr0||ƒ}|r0t|ƒ}||_|S)    a…
    Return compiler version, or None if compiler is not available.
 
    Parameters
    ----------
    force : bool, optional
        If True, force a new determination of the version, even if the
        compiler already has a version attribute. Default is False.
    ok_status : list of int, optional
        The list of status values returned by the version look-up process
        for which a version string is returned. If the status value is not
        in `ok_status`, None is returned. Default is ``[0]``.
 
    Returns
    -------
    version : str or None
        Version string, in the format of `distutils.version.LooseVersion`.
 
    rµNrcs"t ˆ|¡}|sdS| d¡}|S)Nrµ)r_rØrÚ)rÛrErµ©rÞr"r#rà{s
 
z&CCompiler_get_version.<locals>.matcher)rLrNrA)r°rµrIÚ version_cmdr^Z version_matchZversion_patternrTrUrVrWrXrYr0rr)    r;ÚforceZ    ok_statusrãràrXrcÚstatusrµr"râr#ÚCCompiler_get_versionWsD
 
 
 
 
 
rær¿cCsÎ|jdkr|St|ƒ}|j|_|jdgt|jdd…ƒ|_tj d¡r|d|jdkr||jd|jdg|jdd…|_tj d¡r®|j     d    ¡|j     d
¡|j     d
¡n|jdg|jdd…|_|S) z²
    Return the C++ compiler.
 
    Parameters
    ----------
    None
 
    Returns
    -------
    cxx : class instance
        The C++ compiler, as a `CCompiler` instance.
 
    )ÚmsvcÚintelwÚintelemwrrjN)ÚaixÚos400Z    ld_so_aixrkrëz-D__STDC_FORMAT_MACROSz-fno-extern-tls-init)
r‘rrÈrrr[ÚplatformrpÚ    linker_sort)r;Úcxxr"r"r#ÚCCompiler_cxx_compilerœs&
 
ÿ  ÿ ÿ   rïZ cxx_compiler)ÚintelccompilerZIntelCCompilerz(Intel C Compiler for 32-bit applicationsÚintel)rðZIntelItaniumCCompilerz7Intel C Itanium Compiler for Itanium-based applicationsÚintele)rðZIntelEM64TCCompilerz(Intel C Compiler for 64-bit applicationsÚintelem)rðZIntelCCompilerWz3Intel C Compiler for 32-bit applications on Windowsrè)rðZIntelEM64TCCompilerWz3Intel C Compiler for 64-bit applications on Windowsré)Z pathccompilerZPathScaleCCompilerz2PathScale Compiler for SiCortex-based applicationsÚpathcc)Z armccompilerZ ArmCCompilerzArm C CompilerÚarm))úlinux.*rñ)rörò)röró)rörô)Úntrè)r÷réÚwin32)Zmingw32ccompilerZMingw32CCompilerz>Mingw32 port of GNU C Compiler for Win32(for MSC built Python)rz+Setting mingw32 as default compiler for nt.))r÷rc CsŠ|dkrt ¡tjk}|dkr$tj}z"|dkr6t|ƒ}t|\}}}Wn8tk
r~d|}|dk    rr|d|}t|ƒ‚YnXd|}z t    |ƒWnŽt
k
r"}    znt |    ƒ}t  dt |ƒ¡|dd…}z t    |ƒWn8t
k
r}    zt |    ƒ}t d|ƒ‚W5d}    ~    XYnXW5d}    ~    XYnXztj|}
t|
ƒ|} Wn&tk
rdt d||fƒ‚YnX| d||ƒ}||_t d| ¡|S)    Nz5don't know how to compile C/C++ code on platform '%s'z with '%s' compilerznumpy.distutils.z,%s in numpy.distutils; trying from distutilséz4can't compile C/C++ code: unable to load module '%s'zBcan't compile C/C++ code: unable to find class '%s' in module '%s'znew_compiler returns %s)rZ get_thresholdÚINFOr&r±rrÚKeyErrorr Ú
__import__Ú ImportErrorÚstrrRr
r[ÚmodulesÚvarsrSr™) Úplatr¢rSÚdry_runräÚ module_nameÚ
class_nameÚlong_descriptionrgrfÚmodulerCr"r"r#råsP  ÿ  ÿ*
ÿ  rcCsBt||||ƒ}g}|D]&}t|ƒr2| t|ƒ¡q| |¡q|Sr:)Ú_distutils_gen_lib_optionsrÚextendrQrt)r¢r«Úruntime_library_dirsrªrZlib_optsryr"r"r#rsÿ r)Zmsvc9rçZ_msvcZbcppZcygwincZemxcZunixcz
distutils.r¢)NN)rr)NNNrNNN)r")r)r×rr)NNNrr)Br&r_r[r,r‚rTrÚ    distutilsrÚdistutils.ccompilerrrrrrÚdistutils.errorsr    r
r r r Údistutils.sysconfigrZdistutils.versionrZnumpy.distutilsrZnumpy.distutils.exec_commandrrZnumpy.distutils.misc_utilrrrrrrr‹r…ÚLockrÚsetr€r9rFrHrhr{r r´r¾rÄrÖrárærïZ_default_compilersrìrRZ_distutils_new_compilerrZ_ccrÿÚgetÚ_mrBr"r"r"r#Ú<module>sš      2 
 
G 
- þ
 
0  
Q 
/C $  
ÿü
,