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
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
U
O±d]¢ã@sâdZddddgZddlZddlZddlZddlmZddlmZdd    l    m
Z
m Z m Z m Z mZdd
lmZmZdd lmZmZdd lmZdd lmZmZmZmZmZddlmZddlmZddl m!Z!e"Z#Gdd„de$ƒZ%dd„Z&dd„Z'dd„Z(Gdd„deƒZ)dZ*da+da,dd„Z-d5dd „Z.d6d!d"„Z/d7d#d$„Z0e1ƒa2d8d%d„Z3d9d&d„Z4d'd„Z5e 6d(ej7¡j8Z9e 6d)ej7¡j:Z;e 6d*ej7¡j:Z<e 6d+ej7¡j:Z=e 6d,ej7¡j8Z>d-d.„Z?d/d0„Z@e 6d1ej7¡ZAd2d3„ZBeCd4krÞe4ƒdS):aénumpy.distutils.fcompiler
 
Contains FCompiler, an abstract base class that defines the interface
for the numpy.distutils Fortran compiler abstraction model.
 
Terminology:
 
To be consistent, where the term 'executable' is used, it means the single
file, like 'gcc', that is executed, and should be a string. In contrast,
'command' means the entire command line, like ['gcc', '-c', 'file.c'], and
should be a list.
 
But note that FCompiler.executables is actually a dictionary of commands.
 
Ú    FCompilerÚ new_fcompilerÚshow_fcompilersÚdummy_fortran_fileéN)Úget_python_lib)Ú FancyGetopt)ÚDistutilsModuleErrorÚDistutilsExecErrorÚ CompileErrorÚ    LinkErrorÚDistutilsPlatformError)Ú split_quotedÚ    strtobool)Ú    CCompilerÚgen_lib_options)Úlog)Ú    is_stringÚ all_stringsÚ is_sequenceÚmake_temp_fileÚget_shared_lib_extension©Úfind_executable)Ú _shell_utilsé)ÚEnvironmentConfigc@s eZdZdS)ÚCompilerNotFoundN)Ú__name__Ú
__module__Ú __qualname__©r r úYd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/distutils/fcompiler/__init__.pyr(srcCst|ƒrt|ƒS|SdS©N)rr ©Úsr r r!Úflaglist+sr%cCst|ƒrt|ƒSt|ƒSr")rrÚboolr#r r r!Ústr2bool1sr'cCst|ƒot|ƒSr")rr)Úseqr r r!Úis_sequence_of_strings6sr)c@sxeZdZdZeddddedfdddedfdddedfdddedfd    Zedd
d d d ddddd    Zeddddedfdddedfdddedfdddedfddd edfd!ddedfd"ddedfd#d$d%edfd&ddedfd'ddedfd(d)d*edfd+ddedfd,ddedfd-d.d/edfd0d1d2edfd3d1d2edfd4d5d6edfd7Z    d8d8d8d8d8d9d9d9d:œZ
d9d8gZ dZ d;Z dZgZd8d<gd8gd9gd9d=gd9d>gd9gd?d@gddAœZdZdBZdCZdCZdZdDZgZdEdFdGdHdIdJdKdLdMg    ZdNZeƒZdOZdPZdQZdRZiZ dSdTdUdVdWdXdYdZgZ!dZ"gZ#gZ$d[d\„Z%d]d^„Z&d_d`„Z'dadb„Z(e(dSƒZ)e(dTƒZ*e(dUƒZ+e(dVƒZ,e(dWƒZ-e(dXƒZ.e(dYƒZ/e(dZƒZ0dcdd„Z1dedf„Z2dgdh„Z3didj„Z4dkdl„Z5dmdn„Z6dodp„Z7dqdr„Z8dsdt„Z9dudv„Z:dwdx„Z;dydz„Z<d{d|„Z=d}d~„Z>dd€„Z?dd‚„Z@dƒd„„ZAe?ZBZCe@ZDZEeAZFZGd…d†„ZHd‡dˆ„ZIdd‰gfdŠd‹„ZJd dŒd„ZKdŽd„ZLdd‘„ZMd’d“„ZNd”d•„ZOd–d—„ZPd¡d˜d™„ZQdšd›„ZRdœd„ZSdždŸ„ZTdS)¢ra0Abstract base class to define the interface that must be implemented
    by real Fortran compiler classes.
 
    Methods that subclasses may redefine:
 
        update_executables(), find_executables(), get_version()
        get_flags(), get_flags_opt(), get_flags_arch(), get_flags_debug()
        get_flags_f77(), get_flags_opt_f77(), get_flags_arch_f77(),
        get_flags_debug_f77(), get_flags_f90(), get_flags_opt_f90(),
        get_flags_arch_f90(), get_flags_debug_f90(),
        get_flags_fix(), get_flags_linker_so()
 
    DON'T call these methods (except get_version) after
    constructing a compiler instance or inside any other method.
    All methods, except update_executables() and find_executables(),
    may call the get_version() method.
 
    After constructing a compiler instance, always call customize(dist=None)
    method that finalizes compiler construction and makes the following
    attributes available:
      compiler_f77
      compiler_f90
      compiler_fix
      linker_so
      archiver
      ranlib
      libraries
      library_dirs
    Ú    config_fcNÚnooptFÚnoarchÚdebugÚverbose)Údistutils_sectionr+r,r-r.)zexe.compiler_f77ZF77Zf77execNF)zexe.compiler_f90ÚF90Úf90execNF)zexe.compiler_fixr0r1NF)zexe.version_cmdNNNF)z exe.linker_soÚLDSHAREDÚldsharedNF)zexe.linker_exeZLDZldNF)NÚARÚarNF)NZRANLIBÚranlibNF)    r/Ú compiler_f77Ú compiler_f90Ú compiler_fixÚ version_cmdÚ    linker_soÚ
linker_exeÚarchiverr6z    flags.f77ZF77FLAGSÚf77flagsTz    flags.f90ZF90FLAGSÚf90flagsz
flags.freeZ    FREEFLAGSÚ    freeflagsz    flags.fixz    flags.optZFOPTÚoptz flags.opt_f77z flags.opt_f90z
flags.archZFARCHÚarchzflags.arch_f77zflags.arch_f90z flags.debugZFDEBUGZfdebugzflags.debug_f77zflags.debug_f90zself.get_flagsZFFLAGSÚfflagszflags.linker_soÚLDFLAGSZldflagszflags.linker_exezflags.arÚARFLAGSÚarflags)r/Úf77Úf90ÚfreeÚfixrAZopt_f77Zopt_f90rBZarch_f77Zarch_f90r-Z    debug_f77Z    debug_f90Úflagsr;r<r5rGrH)ú.fú.forú.Fú.ftnú.f77ú.f90ú.F90ú.f95r z-vz-fixedz-sharedr5z-cr)r:r7r8r9r;r<r=r6z-cz-o z-IrMrOrPrLrQrSrNrRz.FORz.oz.azlib%s%sú%s%sÚr:r7r8r9r;r<r=r6cOsxtj|f|ž|Ž|j |j¡|_|j |j¡|_|j |j¡|_|j ¡|_|j    D]}||jkrTd|j|<qTd|_
dS)NF) rÚ__init__Údistutils_varsÚcloneÚ_environment_hookÚ command_varsÚ    flag_varsÚ executablesÚcopyÚ_executable_keysÚ_is_customised)ÚselfÚargsÚkwÚer r r!rVÖs 
 
 zFCompiler.__init__cCsZ| |j¡}|j |j¡|j |j¡|_|j |j¡|_|j |j¡|_|j     
¡|_    |Sr") Ú__new__Ú    __class__Ú__dict__ÚupdaterWrXrYrZr[r\r])r`Úobjr r r!Ú__copy__äs  zFCompiler.__copy__cCs| ¡Sr")ri©r`r r r!r]íszFCompiler.copycs‡fdd„}t|dS)Ncs|js
t‚|jˆSr")r_ÚAssertionErrorr\rj©Úkeyr r!Úfgetôs
z)FCompiler._command_property.<locals>.fget)rn)Úproperty)rmrnr rlr!Ú_command_propertyós zFCompiler._command_propertycCs| ||¡dSr")Ú set_command©r`rmÚvaluer r r!Úset_executableszFCompiler.set_executablecKs"| ¡D]\}}| ||¡qdSr")Úitemsrq)r`rbÚkÚvr r r!Ú set_commandsszFCompiler.set_commandscCs`||jkrtd||jjfƒ‚t|ƒr.t|ƒ}|dksRt|dd…ƒsRt||fƒ‚||j|<dS)Nz$unknown executable '%s' for class %sr)    r^Ú
ValueErrorrerrr r)rkr\rrr r r!rq    s
 
ÿÿ$zFCompiler.set_commandcs܈js
t‚ˆj‰‡fdd„‰‡fdd„}d‡‡fdd„    }ˆj}|dƒ}|st|d    ƒ}|rft d
|¡qžtd |ƒ‚n*|d    |d }|s’t d |¡|d|d |d||d|d||d|d||d|dƒ|dƒdS)a3Go through the self.executables dictionary, and attempt to
        find and assign appropriate executables.
 
        Executable names are looked for in the environment (environment
        variables, the distutils.cfg, and command line), the 0th-element of
        the command list, and the self.possible_executables list.
 
        Also, if the 0th element is "<F77>" or "<F90>", the Fortran 77
        or the Fortran 90 compiler executable is used, unless overridden
        by an environment setting.
 
        Subclasses should call this if overridden.
        cs,|ˆkrˆ|St|ƒ}|ˆ|<ˆ|<|Sr"r)ÚexeÚfc_exe)Ú    exe_cacher r!Úcached_find_executable(s
z:FCompiler.find_executables.<locals>.cached_find_executablecs*|dk    r&t|ƒs&td||ˆjjfƒ‚dS)Nz"%s value %r is invalid in class %s)r)ryrer)Únamersrjr r!Úverify_command_form.s  ÿÿz7FCompiler.find_executables.<locals>.verify_command_formNc sȈj |d¡}|sdStˆj|ƒ}|s6||gˆj}n |gˆj}tƒ}g}|D]@}|dkrb|}n |dkrn|}|rP||kr|qP| |¡| |¡qP|D] }    ˆ|    ƒ}
|
r–|
|d<|
Sq–ˆ |d¡dS)Nz<F77>z<F90>r)    r\ÚgetÚgetattrrZÚpossible_executablesÚsetÚaddÚappendrq) Zexe_keyrGrHÚcmdZexe_from_environZ    possiblesÚseenZunique_possiblesrcrzr{)r}r`r r!Úset_exe3s2   
 
 z+FCompiler.find_executables.<locals>.set_exer8r7z %s: no Fortran 90 compiler foundz%s: f90 nor f77)rHz %s: no Fortran 77 compiler foundr9r;)rGrHr<r:r=r6)NN)r_rkÚ
_exe_cacheÚ compiler_typerÚwarnr)r`rrˆÚctyperHrGr )r}r|r`r!Úfind_executabless*
     zFCompiler.find_executablescCsdS)aqCalled at the beginning of customisation. Subclasses should
        override this if they need to set up the executables dictionary.
 
        Note that self.find_executables() is run afterwards, so the
        self.executables dictionary values can contain <F77> or <F90> as
        the command, which will be replaced by the found F77 or F90
        compiler.
        Nr rjr r r!Úupdate_executablesgs    zFCompiler.update_executablescCs
g|jS)z+List of flags common to all compiler types.)Ú    pic_flagsrjr r r!Ú    get_flagsrszFCompiler.get_flagscCs&|j |d¡}|dkrgS|dd…S)Nr)r\r€)r`rmr†r r r!Ú_get_command_flagsvszFCompiler._get_command_flagscCs
| d¡S)z"List of Fortran 77 specific flags.r7©r‘rjr r r!Ú get_flags_f77|szFCompiler.get_flags_f77cCs
| d¡S)z"List of Fortran 90 specific flags.r8r’rjr r r!Ú get_flags_f90szFCompiler.get_flags_f90cCsgS)z.List of Fortran 90 free format specific flags.r rjr r r!Úget_flags_free‚szFCompiler.get_flags_freecCs
| d¡S)z/List of Fortran 90 fixed format specific flags.r9r’rjr r r!Ú get_flags_fix…szFCompiler.get_flags_fixcCs
| d¡S)z/List of linker flags to build a shared library.r;r’rjr r r!Úget_flags_linker_soˆszFCompiler.get_flags_linker_socCs
| d¡S)z,List of linker flags to build an executable.r<r’rjr r r!Úget_flags_linker_exe‹szFCompiler.get_flags_linker_execCs
| d¡S)zList of archiver flags. r=r’rjr r r!Ú get_flags_arŽszFCompiler.get_flags_arcCsgS)z0List of architecture independent compiler flags.r rjr r r!Ú get_flags_opt‘szFCompiler.get_flags_optcCsgS)z.List of architecture dependent compiler flags.r rjr r r!Úget_flags_arch”szFCompiler.get_flags_archcCsgS)z=List of compiler flags to compile with debugging information.r rjr r r!Úget_flags_debug—szFCompiler.get_flags_debugcCs|jdd…S)zList of compiler libraries.N)Ú    librariesrjr r r!Ú get_librariesŸszFCompiler.get_librariescCs|jdd…S)z%List of compiler library directories.N)Ú library_dirsrjr r r!Úget_library_dirs¢szFCompiler.get_library_dirsrcCs,|js
t‚tj|||d}|dkr(tƒ‚|S)N)ÚforceÚ    ok_status)r_rkrÚ get_versionr)r`r¡r¢Úversionr r r!r£¦s
 
zFCompiler.get_versioncsÞt dˆjj¡dˆ_ˆj |¡ˆj |¡ˆj |¡ˆ     ¡ˆ 
¡ˆj  dd¡}ˆj  d|¡}ˆj  dd¡}ˆjj ‰ˆjj ‰g‰g‰g}g‰ˆr®tj ˆ¡‰ˆjj‰ˆrÎtj ˆ¡‰ˆjj‰ˆjj}ˆjj‰ˆròtj ˆ¡‰ˆjjˆ‰ggg}}}‡‡‡‡‡‡‡fdd„}    |s:|    d    |ƒ|s:|    d
|ƒ|rJ|    d|ƒˆjj|||}
ˆrxˆjˆˆ|
d ˆr–ˆjˆ|ˆ|
d ˆr°ˆjˆˆ|
d ˆj} | rrˆjj} tj d¡rtdd} tj | dd¡}tj | dd¡}|g| d|g} tj d¡rbddl m!}|dƒ}tj |d¡}tj |d¡}|g| d|g} ˆj| | dˆj"}|r–ˆjj"}ˆj||dˆjj#}|r¾ˆjj$}ˆj|g|dˆ %ˆ &¡¡ˆ 'ˆ (¡¡dS)a¥Customize Fortran compiler.
 
        This method gets Fortran compiler specific information from
        (i) class definition, (ii) environment, (iii) distutils config
        files, and (iv) command line (later overrides earlier).
 
        This method should be always called after constructing a
        compiler instance. But not in __init__ because Distribution
        instance is needed for (iii) and (iv).
        z customize %sTr+Fr,r-cs€| tˆj|ƒ¡tˆd|ƒ}dˆˆfdˆˆfdˆˆffD]>\}}}d||f}|r<|tˆd|ƒk    r<| tˆj|ƒ¡q<dS)NÚ
get_flags_rGrHz%s_%s)Úextendrr[)ÚtagrKZthis_getr~ÚcZflagvarÚt©rGr>rHr?rJZfixflagsr`r r!rîsþ z&FCompiler.customize.<locals>.get_flagsrArB)r7)r8)r9Úaixr)Ú standard_libÚconfigÚ    ld_so_aixz
python.expz-bI:Zos400r)Úget_config_varZLIBPL)r;)r<)r=N))rÚinforerr_rWZuse_distributionrZr[rŽrr€r7r8rZ NativeParserÚsplitrGrHrIr9rJrKrxr;ÚsysÚplatformÚ
startswithrÚosÚpathÚjoinÚdistutils.sysconfigr¯r<r=r5Zset_library_dirsr Z set_librariesrž)r`Údistr+r,r-r@ZoflagsZaflagsZdflagsrrCr;Zlinker_so_flagsZ
python_libr®Z
python_expr¯Z python_configr<Zlinker_exe_flagsr5rFr rªr!Ú    customize²s†        
 
 
 
 
 zFCompiler.customizecCs¦g}t|j ¡ƒdddddgD]0}t||ƒr t||ƒ}| |ddt|ƒf¡q | ¡t|ƒ}|     d|j
j ¡D],}|dd    …d
kr˜d |d    d…}t |ƒqtdS) z0Print out the attributes of a compiler instance.r¤rrŸÚ object_switchÚcompile_switchNz= z%s instance properties:éz  --z  ) Úlistr\ÚkeysÚhasattrrr…ÚreprÚsortrÚ generate_helprerÚprint)r`ÚpropsrmrwÚpretty_printerÚlr r r!Údump_properties's$ ÿÿ
 
ÿ
zFCompiler.dump_propertiesc
Cs¶i}t|ƒr2t|ƒs2d}|j}    t|ƒ}|jp.g}
njt|ƒrld}|j}    |    dkr`td|jj    |fƒ‚|j
phg}
n0d}|j }    |    dkr’td|jj    |fƒ‚|j
pšg}
|j ddkrº|j   ¡|g} n|j   ¡|g} |j  ¡sØt‚|j|g} |
rt d    |d
d…d |
¡f¡| |jg¡} | r0t d d | ¡¡|    || | | ||
}d tj |    d ¡||f}z|j||dWn6tk
r°}zt|ƒ}t|ƒd‚W5d}~XYnXdS)zCompile 'src' to product 'obj'.z:f77z:f90Nz%f90 not supported by %s needed for %sz:fixz-f90 (fixed) not supported by %s needed for %séÿÿÿÿú zextra %s options: %rrz%using compile options from source: %rz%s: %sr)Údisplay)Ú    is_f_fileÚhas_f90_headerr7Ú get_f77flagsÚextra_f77_compile_argsÚis_free_formatr8r    rerÚextra_f90_compile_argsr9r»Ústripr¼rkrr°r·r€rŠrµr¶ÚbasenameÚspawnÚstrr
)r`rhÚsrcÚextZcc_argsÚextra_postargsZpp_optsZ    src_flagsZflavorÚcompilerÚextra_compile_argsÚo_argsÚs_argsÚ extra_flagsÚcommandrËrcÚmsgr r r!Ú_compile;s` 
ÿ 
ÿ
 
ÿÿÿÿÿzFCompiler._compilecCs°g}|jdk    rH|jddkr2| |j ¡|g¡qb| |j ¡|¡ntd|ƒtd|jjƒ|jdk    r’|g|D]}| d|j|f¡qvntd|ƒtd|jjƒ|S)NrÉrÊz'XXX: module_build_dir=%r option ignoredzXXX: Fix module_dir_switch for rTz"XXX: module_dirs=%r option ignoredz#XXX: Fix module_include_switch for )Úmodule_dir_switchr¦rÒr…rÄrerÚmodule_include_switch)r`Z module_dirsZmodule_build_dirÚoptionsÚdr r r!Úmodule_optionsms
 
 zFCompiler.module_optionscCsd|S)Nz-lr )r`Úlibr r r!Úlibrary_optionszFCompiler.library_optioncCsd|S)Nz-Lr )r`Údirr r r!Úlibrary_dir_optionszFCompiler.library_dir_optionc
Cs| ||¡\}}| |||¡\}}}t||||ƒ}t|ƒrJtj ||¡}n|dk    rZtdƒ‚| ||¡r€|j    ddkr†|j     
¡|g}n|j     
¡|g}t|j ƒr®||j g}n
||j }|||}|    rÖdg|dd…<|
ræ|
|dd…<| rô|  | ¡|  tj |¡¡|tjkr"|jdd…}n|jdd…}||}z| |¡Wn6tk
r|}zt|ƒ}t|ƒd‚W5d}~XYnXn t d|¡dS)Nz%'output_dir' must be a string or NonerÉrÊz-grzskipping %s (up-to-date))Z_fix_object_argsZ _fix_lib_argsrrrµr¶r·Ú    TypeErrorZ
_need_linkÚlibrary_switchrÒÚobjectsr¦ÚmkpathÚdirnamerZ
EXECUTABLEr<r;rÔr    rÕr rr-)r`Z target_descrìZoutput_filenameÚ
output_dirrrŸÚruntime_library_dirsÚexport_symbolsr-Z extra_preargsrØÚ
build_tempZ target_langZlib_optsrÛZld_argsZlinkerrÞrcrßr r r!Úlink„sF ÿÿ
 
 
 zFCompiler.linkcCs¢|dkr dSt|ƒr˜| d¡r:|dd…}t||ƒ}|ƒS| d¡rl|dd…}|j|}|rf|dSdSqž| d¡rž|dd…}t|d|ƒ}|ƒSn|ƒSdS)    Nzself.ézexe.r½rzflags.ér¥)rr´rr\)r`r~Ú    hook_nameÚhookÚvarr r r!rY³s$
 
 
 
 
 zFCompiler._environment_hookcCsdS)zc
        Check if the given C compiler can link objects produced by
        this compiler.
        Tr )r`Z    ccompilerr r r!Úcan_ccompiler_linkÉszFCompiler.can_ccompiler_linkcCs
tƒ‚dS)a¨
        Convert a set of object files that are not compatible with the default
        linker, to a file that is compatible.
 
        Parameters
        ----------
        objects : list
            List of object files to include.
        output_dir : str
            Output directory to place generated object files.
        extra_dll_dir : str
            Output directory to place extra DLL files that need to be
            included on Windows.
 
        Returns
        -------
        converted_objects : list of str
             List of converted object files.
             Note that the number of output files is not necessarily
             the same as inputs.
 
        N)ÚNotImplementedError)r`rìrïZ extra_dll_dirr r r!Úwrap_unlinkable_objectsÐsz!FCompiler.wrap_unlinkable_objects)N)
NNNNNrNNNN)UrrrÚ__doc__rr'rWrZr%r[Z language_mapZlanguage_orderrŠÚcompiler_aliasesZversion_patternr‚r\Úsuggested_f90_compilerr¼r»rërárârZsrc_extensionsZ obj_extensionrÚshared_lib_extensionZstatic_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionr‰r^Ú
c_compilerrÏrÑrVrir]rpr:r7r8r9r;r<r=r6rtrxrqrrŽrr‘r“r”r•r–r—r˜r™ršr›rœZget_flags_opt_f77Zget_flags_opt_f90Zget_flags_arch_f77Zget_flags_arch_f90Zget_flags_debug_f77Zget_flags_debug_f90ržr r£rºrÈràrårçrérórYrùrûr r r r!r9s(    û÷                  îù    øþ    O 
u2ü
/)
)Úwin32)
ÚgnuÚintelvÚabsoftÚcompaqvÚintelevÚgnu95Úg95ZintelvemÚintelemZflang)zcygwin.*)rrrrrrr)zlinux.*)ÚarmrÚintelZlaheyÚpgÚnvrÚnagZvastZcompaqZinteler    rrZpathf95ÚnagforZfujitsu)zdarwin.*)    rrrrÚibmr rrr )zsunos.*)Úsunrrr)zirix.*)Zmipsrr)zaix.*)rrr)Úposix©rr)Úntr)Úmac)rrr c
    Csìddlm}tdk    rdStj tj t¡d¡}iaia||ƒD]¨}tj tj     |¡¡\}}d|}t
|ƒt j |}t |dƒr>|jD]`}t||ƒ}|j||jf}|t|j<|jD]2}    |    tkrÚtd|    |jt|    djfƒ‚|t|    <q°q„q>dS)    zcCache all the FCompiler classes found in modules in the
    numpy.distutils.fcompiler package.
    r)ÚglobNz*.pyznumpy.distutils.fcompiler.Ú    compilersz#alias %r defined for both %s and %sr)rÚfcompiler_classrµr¶r·rîÚ__file__Úfcompiler_aliasesÚsplitextrÓÚ
__import__r²ÚmodulesrÀrrrŠÚ descriptionrýryr)
rZpysÚfnameÚ module_namer×ÚmoduleÚcnameÚklassÚdescÚaliasr r r!Úload_all_fcompiler_classess0  
 
 
 
 
 
 ÿÿr&Fc     Csddlm}|dd}|D]ô}d}zœt|||d}    |     |¡|     ¡}|rž|    jdkržd}|    j}
|
ržt d||
f¡t||
|d}    |     |¡|     ¡}|dk    rž|
}|r¼|    jdkr¼t    d|    j
j ƒ‚Wn>t k
rÞt  d|¡Yn tk
rüt  d    |¡YnX|dk    r|SqdS)
Nr)Úget_distributionT)Úalways)ÚplatrÙrz?Trying %r compiler as suggested by %r compiler for f90 support.z2%s does not support compiling f90 codes, skipping.zH_find_existing_fcompiler: compiler_type='%s' raised DistutilsModuleErrorz6_find_existing_fcompiler: compiler_type='%s' not found)Znumpy.distutils.corer'rrºr£r8rþrr‹ryrerrr-r) Zcompiler_typesÚosnamer³Ú
requiref90rr'r¹rŠrwr¨Z new_compilerr r r!Ú_find_existing_fcompilersJ 
ÿ
ÿÿÿ
ÿ
 
r,cCst|dkrtj}|dkrtj}g}tD]<\}}t ||¡sDt ||¡r$|D]}||krH| |¡qHq$|sp| d¡|S)Nr)rµr~r²r³Ú_default_compilersÚreÚmatchr…)r*r³Úmatching_compiler_typesÚpatternrŠÚctr r r!Ú!available_fcompilers_for_platformBs 
r3cCs,t||ƒ}t d|¡t|||||d}|S)zIDetermine the default Fortran compiler to use for the given
    platform.z+get_default_fcompiler: matching types: '%s')r*r³r+r)r3rr°r,)r*r³r+rr0rŠr r r!Úget_default_fcompilerQsÿÿür4c CsÐ||f}|tkrdStƒ|dkr(tj}|dkr>t|||d}|tkrVt|\}}    }
nb|tkrnt|\}}    }
nJd|} |dk    r | d|} | dd t ¡¡} t     
| ¡t  |¡dS|    |||d}||_ |S)zhGenerate an instance of some FCompiler subclass for the supplied
    platform/compiler combination.
    N)r+rz7don't know how to compile Fortran code on platform '%s'z with '%s' compiler.z Supported compilers are: %s)ú,)r.Údry_runr¡) Úfailed_fcompilersr&rµr~r4rrr·r¿rr‹r„r) r)rÙr.r6r¡r+rZ fcompiler_keyr r#Úlong_descriptionrßr r r!rcs4 ÿ  ÿ
 
c Cs
|dkrddlm}ddlm}|ƒ}tj tjd¡|_    dgtjdd…|_
z|j
  d¡Wnt k
rtYnX||j d<| ¡| ¡g}g}g}ts¦tƒtƒ}|D]Ò}d}t d¡z$t||jd    }    |     |¡|     ¡}WnFttfk
r,}
z"t d
|f¡t t|
ƒ¡W5d}
~
XYnX|dkrV| d |dt|d f¡q°|     ¡| d |dt|d d |f¡q°tt t !¡ƒt |ƒƒ}dd„|Dƒ}| "¡| "¡| "¡t#|ƒ} |  $d¡t#|ƒ} |  $d¡|rþt#|ƒ} |  $d¡t%dƒdS)zbPrint list of available compilers (used by the "--help-fcompiler"
    option to "config_fc").
    Nr)Ú Distribution)r*r*rz--help-fcompileréþÿÿÿ)rÙr.zshow_fcompilers: %s not foundú
fcompiler=éz (%s)cSs"g|]}d|dt|df‘qS)r;Nr<)r)Ú.0Zfcr r r!Ú
<listcomp>µsÿz#show_fcompilers.<locals>.<listcomp>zFortran compilers found:z5Compilers available for this platform, but not found:z)Compilers not available on this platform:z>For compiler details, run 'config_fc --verbose' setup command.)&Údistutils.distr9Z'numpy.distutils.command.config_compilerr*rµr¶rÓr²ÚargvÚ script_nameÚ script_argsÚremoveryÚcmdclassÚparse_config_filesÚparse_command_linerr&r3rÚ set_verbosityrr.rºr£rrr-rÁr…rÈr¾rƒr¿rÂrÚ
print_helprÄ) r¹r9r*rZ compilers_naZ compilers_niZplatform_compilersrÙrwr¨rcrÆr r r!rŠsh  
 
 
  
 
ÿ ÿÿ
 
 
cCs,tdd\}}| d¡| ¡|dd…S)NrL)Úsuffixz#      subroutine dummy()
      end
r:)rÚwriteÚclose)Úfor~r r r!rÆs
z.*\.(for|ftn|f77|f)\Zz-\*-\s*fortran\s*-\*-z-\*-\s*f90\s*-\*-z-\*-\s*fix\s*-\*-z[^c*!]\s*[^\s\d\t]c    Csºd}t|dd }| ¡}d}t|ƒs.t|ƒr4d}nt|ƒrDd}d}|dkr¬|r¬| ¡}|r¢|ddkr¢|d8}|ddkrŒt|dd    …ƒsœ|d
d…d kr¢d}q¬| ¡}qDW5QRX|S) z(Check if file is in free format Fortran.rÚlatin1©Úencodingi'rú!ú    NrôrÉú&)ÚopenÚreadlineÚ _has_f_headerÚ_has_fix_headerÚ_has_f90_headerÚrstripÚ_free_f90_start)ÚfileÚresultÚfÚlineÚnr r r!rÐÓs$ ,rÐc    Cs0t|dd}| ¡}W5QRXt|ƒp.t|ƒS)NrMrN)rSrTrWrV)rÖr\r]r r r!rÍêsrÍz=(c|)f77flags\s*\(\s*(?P<fcname>\w+)\s*\)\s*=\s*(?P<fflags>.*)c    Cszi}t|dd`}d}|D]P}|d7}|dkr2qlt |¡}|sBq| d¡ ¡}| d¡ ¡}t|ƒ||<qW5QRX|S)z¯
    Search the first 20 lines of fortran 77 code for line pattern
      `CF77FLAGS(<fcompiler type>)=<f77 flags>`
    Return a dictionary {<fcompiler type>:<f77 flags>}.
    rMrNrréÚfcnamerC)rSÚ _f77flags_rer/ÚgrouprÒr )rÖrKr\Úir]Úmr`rCr r r!rÎðs
rÎÚ__main__)NNFN)NN)NNFN)NNrrrFN)N)DrüÚ__all__rµr²r.r¸rÚdistutils.fancy_getoptrÚdistutils.errorsrr    r
r r Údistutils.utilr rZnumpy.distutils.ccompilerrrZnumpy.distutilsrZnumpy.distutils.misc_utilrrrrrZnumpy.distutils.exec_commandrrÚ environmentrÚtypeÚ __metaclass__Ú    Exceptionrr%r'r)rr-rrr&r,r3r4rƒr7rrrÚcompileÚIr/rÌÚsearchrUrWrVrYrÐrÍrarÎrr r r r!Ú<module>s|ÿ      7ý
%
ÿ
ú
'
<