koichi12 commited on
Commit
70a8abe
·
verified ·
1 Parent(s): 33d0f2f

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/__init__.cpython-311.pyc +0 -0
  2. .venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/core.cpython-311.pyc +0 -0
  3. .venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/lib2def.cpython-311.pyc +0 -0
  4. .venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/line_endings.cpython-311.pyc +0 -0
  5. .venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/log.cpython-311.pyc +0 -0
  6. .venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/mingw32ccompiler.cpython-311.pyc +0 -0
  7. .venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/numpy_distribution.cpython-311.pyc +0 -0
  8. .venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/setup.cpython-311.pyc +0 -0
  9. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__init__.py +1035 -0
  10. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/absoft.cpython-311.pyc +0 -0
  11. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/arm.cpython-311.pyc +0 -0
  12. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/compaq.cpython-311.pyc +0 -0
  13. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/environment.cpython-311.pyc +0 -0
  14. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/fujitsu.cpython-311.pyc +0 -0
  15. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/g95.cpython-311.pyc +0 -0
  16. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/gnu.cpython-311.pyc +0 -0
  17. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/hpux.cpython-311.pyc +0 -0
  18. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/ibm.cpython-311.pyc +0 -0
  19. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/lahey.cpython-311.pyc +0 -0
  20. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/nag.cpython-311.pyc +0 -0
  21. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/nv.cpython-311.pyc +0 -0
  22. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/pg.cpython-311.pyc +0 -0
  23. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/vast.cpython-311.pyc +0 -0
  24. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/absoft.py +156 -0
  25. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/arm.py +71 -0
  26. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/compaq.py +120 -0
  27. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/environment.py +88 -0
  28. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/fujitsu.py +46 -0
  29. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/g95.py +42 -0
  30. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/gnu.py +555 -0
  31. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/hpux.py +41 -0
  32. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/ibm.py +97 -0
  33. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/intel.py +211 -0
  34. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/lahey.py +45 -0
  35. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/mips.py +54 -0
  36. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/nag.py +87 -0
  37. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/none.py +28 -0
  38. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/nv.py +53 -0
  39. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/pathf95.py +33 -0
  40. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/pg.py +128 -0
  41. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/sun.py +51 -0
  42. .venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/vast.py +52 -0
  43. .venv/lib/python3.11/site-packages/numpy/distutils/mingw/gfortran_vs2003_hack.c +6 -0
  44. .venv/lib/python3.11/site-packages/numpy/distutils/tests/__init__.py +0 -0
  45. .venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/__init__.cpython-311.pyc +0 -0
  46. .venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_build_ext.cpython-311.pyc +0 -0
  47. .venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt.cpython-311.pyc +0 -0
  48. .venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt_conf.cpython-311.pyc +0 -0
  49. .venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_exec_command.cpython-311.pyc +0 -0
  50. .venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler.cpython-311.pyc +0 -0
.venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (2.46 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/core.cpython-311.pyc ADDED
Binary file (8.81 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/lib2def.cpython-311.pyc ADDED
Binary file (5.6 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/line_endings.cpython-311.pyc ADDED
Binary file (4.22 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/log.cpython-311.pyc ADDED
Binary file (5.09 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/mingw32ccompiler.cpython-311.pyc ADDED
Binary file (24.7 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/numpy_distribution.cpython-311.pyc ADDED
Binary file (1.08 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/__pycache__/setup.cpython-311.pyc ADDED
Binary file (1.31 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__init__.py ADDED
@@ -0,0 +1,1035 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """numpy.distutils.fcompiler
2
+
3
+ Contains FCompiler, an abstract base class that defines the interface
4
+ for the numpy.distutils Fortran compiler abstraction model.
5
+
6
+ Terminology:
7
+
8
+ To be consistent, where the term 'executable' is used, it means the single
9
+ file, like 'gcc', that is executed, and should be a string. In contrast,
10
+ 'command' means the entire command line, like ['gcc', '-c', 'file.c'], and
11
+ should be a list.
12
+
13
+ But note that FCompiler.executables is actually a dictionary of commands.
14
+
15
+ """
16
+ __all__ = ['FCompiler', 'new_fcompiler', 'show_fcompilers',
17
+ 'dummy_fortran_file']
18
+
19
+ import os
20
+ import sys
21
+ import re
22
+ from pathlib import Path
23
+
24
+ from distutils.sysconfig import get_python_lib
25
+ from distutils.fancy_getopt import FancyGetopt
26
+ from distutils.errors import DistutilsModuleError, \
27
+ DistutilsExecError, CompileError, LinkError, DistutilsPlatformError
28
+ from distutils.util import split_quoted, strtobool
29
+
30
+ from numpy.distutils.ccompiler import CCompiler, gen_lib_options
31
+ from numpy.distutils import log
32
+ from numpy.distutils.misc_util import is_string, all_strings, is_sequence, \
33
+ make_temp_file, get_shared_lib_extension
34
+ from numpy.distutils.exec_command import find_executable
35
+ from numpy.distutils import _shell_utils
36
+
37
+ from .environment import EnvironmentConfig
38
+
39
+ __metaclass__ = type
40
+
41
+
42
+ FORTRAN_COMMON_FIXED_EXTENSIONS = ['.for', '.ftn', '.f77', '.f']
43
+
44
+
45
+ class CompilerNotFound(Exception):
46
+ pass
47
+
48
+ def flaglist(s):
49
+ if is_string(s):
50
+ return split_quoted(s)
51
+ else:
52
+ return s
53
+
54
+ def str2bool(s):
55
+ if is_string(s):
56
+ return strtobool(s)
57
+ return bool(s)
58
+
59
+ def is_sequence_of_strings(seq):
60
+ return is_sequence(seq) and all_strings(seq)
61
+
62
+ class FCompiler(CCompiler):
63
+ """Abstract base class to define the interface that must be implemented
64
+ by real Fortran compiler classes.
65
+
66
+ Methods that subclasses may redefine:
67
+
68
+ update_executables(), find_executables(), get_version()
69
+ get_flags(), get_flags_opt(), get_flags_arch(), get_flags_debug()
70
+ get_flags_f77(), get_flags_opt_f77(), get_flags_arch_f77(),
71
+ get_flags_debug_f77(), get_flags_f90(), get_flags_opt_f90(),
72
+ get_flags_arch_f90(), get_flags_debug_f90(),
73
+ get_flags_fix(), get_flags_linker_so()
74
+
75
+ DON'T call these methods (except get_version) after
76
+ constructing a compiler instance or inside any other method.
77
+ All methods, except update_executables() and find_executables(),
78
+ may call the get_version() method.
79
+
80
+ After constructing a compiler instance, always call customize(dist=None)
81
+ method that finalizes compiler construction and makes the following
82
+ attributes available:
83
+ compiler_f77
84
+ compiler_f90
85
+ compiler_fix
86
+ linker_so
87
+ archiver
88
+ ranlib
89
+ libraries
90
+ library_dirs
91
+ """
92
+
93
+ # These are the environment variables and distutils keys used.
94
+ # Each configuration description is
95
+ # (<hook name>, <environment variable>, <key in distutils.cfg>, <convert>, <append>)
96
+ # The hook names are handled by the self._environment_hook method.
97
+ # - names starting with 'self.' call methods in this class
98
+ # - names starting with 'exe.' return the key in the executables dict
99
+ # - names like 'flags.YYY' return self.get_flag_YYY()
100
+ # convert is either None or a function to convert a string to the
101
+ # appropriate type used.
102
+
103
+ distutils_vars = EnvironmentConfig(
104
+ distutils_section='config_fc',
105
+ noopt = (None, None, 'noopt', str2bool, False),
106
+ noarch = (None, None, 'noarch', str2bool, False),
107
+ debug = (None, None, 'debug', str2bool, False),
108
+ verbose = (None, None, 'verbose', str2bool, False),
109
+ )
110
+
111
+ command_vars = EnvironmentConfig(
112
+ distutils_section='config_fc',
113
+ compiler_f77 = ('exe.compiler_f77', 'F77', 'f77exec', None, False),
114
+ compiler_f90 = ('exe.compiler_f90', 'F90', 'f90exec', None, False),
115
+ compiler_fix = ('exe.compiler_fix', 'F90', 'f90exec', None, False),
116
+ version_cmd = ('exe.version_cmd', None, None, None, False),
117
+ linker_so = ('exe.linker_so', 'LDSHARED', 'ldshared', None, False),
118
+ linker_exe = ('exe.linker_exe', 'LD', 'ld', None, False),
119
+ archiver = (None, 'AR', 'ar', None, False),
120
+ ranlib = (None, 'RANLIB', 'ranlib', None, False),
121
+ )
122
+
123
+ flag_vars = EnvironmentConfig(
124
+ distutils_section='config_fc',
125
+ f77 = ('flags.f77', 'F77FLAGS', 'f77flags', flaglist, True),
126
+ f90 = ('flags.f90', 'F90FLAGS', 'f90flags', flaglist, True),
127
+ free = ('flags.free', 'FREEFLAGS', 'freeflags', flaglist, True),
128
+ fix = ('flags.fix', None, None, flaglist, False),
129
+ opt = ('flags.opt', 'FOPT', 'opt', flaglist, True),
130
+ opt_f77 = ('flags.opt_f77', None, None, flaglist, False),
131
+ opt_f90 = ('flags.opt_f90', None, None, flaglist, False),
132
+ arch = ('flags.arch', 'FARCH', 'arch', flaglist, False),
133
+ arch_f77 = ('flags.arch_f77', None, None, flaglist, False),
134
+ arch_f90 = ('flags.arch_f90', None, None, flaglist, False),
135
+ debug = ('flags.debug', 'FDEBUG', 'fdebug', flaglist, True),
136
+ debug_f77 = ('flags.debug_f77', None, None, flaglist, False),
137
+ debug_f90 = ('flags.debug_f90', None, None, flaglist, False),
138
+ flags = ('self.get_flags', 'FFLAGS', 'fflags', flaglist, True),
139
+ linker_so = ('flags.linker_so', 'LDFLAGS', 'ldflags', flaglist, True),
140
+ linker_exe = ('flags.linker_exe', 'LDFLAGS', 'ldflags', flaglist, True),
141
+ ar = ('flags.ar', 'ARFLAGS', 'arflags', flaglist, True),
142
+ )
143
+
144
+ language_map = {'.f': 'f77',
145
+ '.for': 'f77',
146
+ '.F': 'f77', # XXX: needs preprocessor
147
+ '.ftn': 'f77',
148
+ '.f77': 'f77',
149
+ '.f90': 'f90',
150
+ '.F90': 'f90', # XXX: needs preprocessor
151
+ '.f95': 'f90',
152
+ }
153
+ language_order = ['f90', 'f77']
154
+
155
+
156
+ # These will be set by the subclass
157
+
158
+ compiler_type = None
159
+ compiler_aliases = ()
160
+ version_pattern = None
161
+
162
+ possible_executables = []
163
+ executables = {
164
+ 'version_cmd': ["f77", "-v"],
165
+ 'compiler_f77': ["f77"],
166
+ 'compiler_f90': ["f90"],
167
+ 'compiler_fix': ["f90", "-fixed"],
168
+ 'linker_so': ["f90", "-shared"],
169
+ 'linker_exe': ["f90"],
170
+ 'archiver': ["ar", "-cr"],
171
+ 'ranlib': None,
172
+ }
173
+
174
+ # If compiler does not support compiling Fortran 90 then it can
175
+ # suggest using another compiler. For example, gnu would suggest
176
+ # gnu95 compiler type when there are F90 sources.
177
+ suggested_f90_compiler = None
178
+
179
+ compile_switch = "-c"
180
+ object_switch = "-o " # Ending space matters! It will be stripped
181
+ # but if it is missing then object_switch
182
+ # will be prefixed to object file name by
183
+ # string concatenation.
184
+ library_switch = "-o " # Ditto!
185
+
186
+ # Switch to specify where module files are created and searched
187
+ # for USE statement. Normally it is a string and also here ending
188
+ # space matters. See above.
189
+ module_dir_switch = None
190
+
191
+ # Switch to specify where module files are searched for USE statement.
192
+ module_include_switch = '-I'
193
+
194
+ pic_flags = [] # Flags to create position-independent code
195
+
196
+ src_extensions = ['.for', '.ftn', '.f77', '.f', '.f90', '.f95', '.F', '.F90', '.FOR']
197
+ obj_extension = ".o"
198
+
199
+ shared_lib_extension = get_shared_lib_extension()
200
+ static_lib_extension = ".a" # or .lib
201
+ static_lib_format = "lib%s%s" # or %s%s
202
+ shared_lib_format = "%s%s"
203
+ exe_extension = ""
204
+
205
+ _exe_cache = {}
206
+
207
+ _executable_keys = ['version_cmd', 'compiler_f77', 'compiler_f90',
208
+ 'compiler_fix', 'linker_so', 'linker_exe', 'archiver',
209
+ 'ranlib']
210
+
211
+ # This will be set by new_fcompiler when called in
212
+ # command/{build_ext.py, build_clib.py, config.py} files.
213
+ c_compiler = None
214
+
215
+ # extra_{f77,f90}_compile_args are set by build_ext.build_extension method
216
+ extra_f77_compile_args = []
217
+ extra_f90_compile_args = []
218
+
219
+ def __init__(self, *args, **kw):
220
+ CCompiler.__init__(self, *args, **kw)
221
+ self.distutils_vars = self.distutils_vars.clone(self._environment_hook)
222
+ self.command_vars = self.command_vars.clone(self._environment_hook)
223
+ self.flag_vars = self.flag_vars.clone(self._environment_hook)
224
+ self.executables = self.executables.copy()
225
+ for e in self._executable_keys:
226
+ if e not in self.executables:
227
+ self.executables[e] = None
228
+
229
+ # Some methods depend on .customize() being called first, so
230
+ # this keeps track of whether that's happened yet.
231
+ self._is_customised = False
232
+
233
+ def __copy__(self):
234
+ obj = self.__new__(self.__class__)
235
+ obj.__dict__.update(self.__dict__)
236
+ obj.distutils_vars = obj.distutils_vars.clone(obj._environment_hook)
237
+ obj.command_vars = obj.command_vars.clone(obj._environment_hook)
238
+ obj.flag_vars = obj.flag_vars.clone(obj._environment_hook)
239
+ obj.executables = obj.executables.copy()
240
+ return obj
241
+
242
+ def copy(self):
243
+ return self.__copy__()
244
+
245
+ # Use properties for the attributes used by CCompiler. Setting them
246
+ # as attributes from the self.executables dictionary is error-prone,
247
+ # so we get them from there each time.
248
+ def _command_property(key):
249
+ def fget(self):
250
+ assert self._is_customised
251
+ return self.executables[key]
252
+ return property(fget=fget)
253
+ version_cmd = _command_property('version_cmd')
254
+ compiler_f77 = _command_property('compiler_f77')
255
+ compiler_f90 = _command_property('compiler_f90')
256
+ compiler_fix = _command_property('compiler_fix')
257
+ linker_so = _command_property('linker_so')
258
+ linker_exe = _command_property('linker_exe')
259
+ archiver = _command_property('archiver')
260
+ ranlib = _command_property('ranlib')
261
+
262
+ # Make our terminology consistent.
263
+ def set_executable(self, key, value):
264
+ self.set_command(key, value)
265
+
266
+ def set_commands(self, **kw):
267
+ for k, v in kw.items():
268
+ self.set_command(k, v)
269
+
270
+ def set_command(self, key, value):
271
+ if not key in self._executable_keys:
272
+ raise ValueError(
273
+ "unknown executable '%s' for class %s" %
274
+ (key, self.__class__.__name__))
275
+ if is_string(value):
276
+ value = split_quoted(value)
277
+ assert value is None or is_sequence_of_strings(value[1:]), (key, value)
278
+ self.executables[key] = value
279
+
280
+ ######################################################################
281
+ ## Methods that subclasses may redefine. But don't call these methods!
282
+ ## They are private to FCompiler class and may return unexpected
283
+ ## results if used elsewhere. So, you have been warned..
284
+
285
+ def find_executables(self):
286
+ """Go through the self.executables dictionary, and attempt to
287
+ find and assign appropriate executables.
288
+
289
+ Executable names are looked for in the environment (environment
290
+ variables, the distutils.cfg, and command line), the 0th-element of
291
+ the command list, and the self.possible_executables list.
292
+
293
+ Also, if the 0th element is "<F77>" or "<F90>", the Fortran 77
294
+ or the Fortran 90 compiler executable is used, unless overridden
295
+ by an environment setting.
296
+
297
+ Subclasses should call this if overridden.
298
+ """
299
+ assert self._is_customised
300
+ exe_cache = self._exe_cache
301
+ def cached_find_executable(exe):
302
+ if exe in exe_cache:
303
+ return exe_cache[exe]
304
+ fc_exe = find_executable(exe)
305
+ exe_cache[exe] = exe_cache[fc_exe] = fc_exe
306
+ return fc_exe
307
+ def verify_command_form(name, value):
308
+ if value is not None and not is_sequence_of_strings(value):
309
+ raise ValueError(
310
+ "%s value %r is invalid in class %s" %
311
+ (name, value, self.__class__.__name__))
312
+ def set_exe(exe_key, f77=None, f90=None):
313
+ cmd = self.executables.get(exe_key, None)
314
+ if not cmd:
315
+ return None
316
+ # Note that we get cmd[0] here if the environment doesn't
317
+ # have anything set
318
+ exe_from_environ = getattr(self.command_vars, exe_key)
319
+ if not exe_from_environ:
320
+ possibles = [f90, f77] + self.possible_executables
321
+ else:
322
+ possibles = [exe_from_environ] + self.possible_executables
323
+
324
+ seen = set()
325
+ unique_possibles = []
326
+ for e in possibles:
327
+ if e == '<F77>':
328
+ e = f77
329
+ elif e == '<F90>':
330
+ e = f90
331
+ if not e or e in seen:
332
+ continue
333
+ seen.add(e)
334
+ unique_possibles.append(e)
335
+
336
+ for exe in unique_possibles:
337
+ fc_exe = cached_find_executable(exe)
338
+ if fc_exe:
339
+ cmd[0] = fc_exe
340
+ return fc_exe
341
+ self.set_command(exe_key, None)
342
+ return None
343
+
344
+ ctype = self.compiler_type
345
+ f90 = set_exe('compiler_f90')
346
+ if not f90:
347
+ f77 = set_exe('compiler_f77')
348
+ if f77:
349
+ log.warn('%s: no Fortran 90 compiler found' % ctype)
350
+ else:
351
+ raise CompilerNotFound('%s: f90 nor f77' % ctype)
352
+ else:
353
+ f77 = set_exe('compiler_f77', f90=f90)
354
+ if not f77:
355
+ log.warn('%s: no Fortran 77 compiler found' % ctype)
356
+ set_exe('compiler_fix', f90=f90)
357
+
358
+ set_exe('linker_so', f77=f77, f90=f90)
359
+ set_exe('linker_exe', f77=f77, f90=f90)
360
+ set_exe('version_cmd', f77=f77, f90=f90)
361
+ set_exe('archiver')
362
+ set_exe('ranlib')
363
+
364
+ def update_executables(self):
365
+ """Called at the beginning of customisation. Subclasses should
366
+ override this if they need to set up the executables dictionary.
367
+
368
+ Note that self.find_executables() is run afterwards, so the
369
+ self.executables dictionary values can contain <F77> or <F90> as
370
+ the command, which will be replaced by the found F77 or F90
371
+ compiler.
372
+ """
373
+ pass
374
+
375
+ def get_flags(self):
376
+ """List of flags common to all compiler types."""
377
+ return [] + self.pic_flags
378
+
379
+ def _get_command_flags(self, key):
380
+ cmd = self.executables.get(key, None)
381
+ if cmd is None:
382
+ return []
383
+ return cmd[1:]
384
+
385
+ def get_flags_f77(self):
386
+ """List of Fortran 77 specific flags."""
387
+ return self._get_command_flags('compiler_f77')
388
+ def get_flags_f90(self):
389
+ """List of Fortran 90 specific flags."""
390
+ return self._get_command_flags('compiler_f90')
391
+ def get_flags_free(self):
392
+ """List of Fortran 90 free format specific flags."""
393
+ return []
394
+ def get_flags_fix(self):
395
+ """List of Fortran 90 fixed format specific flags."""
396
+ return self._get_command_flags('compiler_fix')
397
+ def get_flags_linker_so(self):
398
+ """List of linker flags to build a shared library."""
399
+ return self._get_command_flags('linker_so')
400
+ def get_flags_linker_exe(self):
401
+ """List of linker flags to build an executable."""
402
+ return self._get_command_flags('linker_exe')
403
+ def get_flags_ar(self):
404
+ """List of archiver flags. """
405
+ return self._get_command_flags('archiver')
406
+ def get_flags_opt(self):
407
+ """List of architecture independent compiler flags."""
408
+ return []
409
+ def get_flags_arch(self):
410
+ """List of architecture dependent compiler flags."""
411
+ return []
412
+ def get_flags_debug(self):
413
+ """List of compiler flags to compile with debugging information."""
414
+ return []
415
+
416
+ get_flags_opt_f77 = get_flags_opt_f90 = get_flags_opt
417
+ get_flags_arch_f77 = get_flags_arch_f90 = get_flags_arch
418
+ get_flags_debug_f77 = get_flags_debug_f90 = get_flags_debug
419
+
420
+ def get_libraries(self):
421
+ """List of compiler libraries."""
422
+ return self.libraries[:]
423
+ def get_library_dirs(self):
424
+ """List of compiler library directories."""
425
+ return self.library_dirs[:]
426
+
427
+ def get_version(self, force=False, ok_status=[0]):
428
+ assert self._is_customised
429
+ version = CCompiler.get_version(self, force=force, ok_status=ok_status)
430
+ if version is None:
431
+ raise CompilerNotFound()
432
+ return version
433
+
434
+
435
+ ############################################################
436
+
437
+ ## Public methods:
438
+
439
+ def customize(self, dist = None):
440
+ """Customize Fortran compiler.
441
+
442
+ This method gets Fortran compiler specific information from
443
+ (i) class definition, (ii) environment, (iii) distutils config
444
+ files, and (iv) command line (later overrides earlier).
445
+
446
+ This method should be always called after constructing a
447
+ compiler instance. But not in __init__ because Distribution
448
+ instance is needed for (iii) and (iv).
449
+ """
450
+ log.info('customize %s' % (self.__class__.__name__))
451
+
452
+ self._is_customised = True
453
+
454
+ self.distutils_vars.use_distribution(dist)
455
+ self.command_vars.use_distribution(dist)
456
+ self.flag_vars.use_distribution(dist)
457
+
458
+ self.update_executables()
459
+
460
+ # find_executables takes care of setting the compiler commands,
461
+ # version_cmd, linker_so, linker_exe, ar, and ranlib
462
+ self.find_executables()
463
+
464
+ noopt = self.distutils_vars.get('noopt', False)
465
+ noarch = self.distutils_vars.get('noarch', noopt)
466
+ debug = self.distutils_vars.get('debug', False)
467
+
468
+ f77 = self.command_vars.compiler_f77
469
+ f90 = self.command_vars.compiler_f90
470
+
471
+ f77flags = []
472
+ f90flags = []
473
+ freeflags = []
474
+ fixflags = []
475
+
476
+ if f77:
477
+ f77 = _shell_utils.NativeParser.split(f77)
478
+ f77flags = self.flag_vars.f77
479
+ if f90:
480
+ f90 = _shell_utils.NativeParser.split(f90)
481
+ f90flags = self.flag_vars.f90
482
+ freeflags = self.flag_vars.free
483
+ # XXX Assuming that free format is default for f90 compiler.
484
+ fix = self.command_vars.compiler_fix
485
+ # NOTE: this and similar examples are probably just
486
+ # excluding --coverage flag when F90 = gfortran --coverage
487
+ # instead of putting that flag somewhere more appropriate
488
+ # this and similar examples where a Fortran compiler
489
+ # environment variable has been customized by CI or a user
490
+ # should perhaps eventually be more thoroughly tested and more
491
+ # robustly handled
492
+ if fix:
493
+ fix = _shell_utils.NativeParser.split(fix)
494
+ fixflags = self.flag_vars.fix + f90flags
495
+
496
+ oflags, aflags, dflags = [], [], []
497
+ # examine get_flags_<tag>_<compiler> for extra flags
498
+ # only add them if the method is different from get_flags_<tag>
499
+ def get_flags(tag, flags):
500
+ # note that self.flag_vars.<tag> calls self.get_flags_<tag>()
501
+ flags.extend(getattr(self.flag_vars, tag))
502
+ this_get = getattr(self, 'get_flags_' + tag)
503
+ for name, c, flagvar in [('f77', f77, f77flags),
504
+ ('f90', f90, f90flags),
505
+ ('f90', fix, fixflags)]:
506
+ t = '%s_%s' % (tag, name)
507
+ if c and this_get is not getattr(self, 'get_flags_' + t):
508
+ flagvar.extend(getattr(self.flag_vars, t))
509
+ if not noopt:
510
+ get_flags('opt', oflags)
511
+ if not noarch:
512
+ get_flags('arch', aflags)
513
+ if debug:
514
+ get_flags('debug', dflags)
515
+
516
+ fflags = self.flag_vars.flags + dflags + oflags + aflags
517
+
518
+ if f77:
519
+ self.set_commands(compiler_f77=f77+f77flags+fflags)
520
+ if f90:
521
+ self.set_commands(compiler_f90=f90+freeflags+f90flags+fflags)
522
+ if fix:
523
+ self.set_commands(compiler_fix=fix+fixflags+fflags)
524
+
525
+
526
+ #XXX: Do we need LDSHARED->SOSHARED, LDFLAGS->SOFLAGS
527
+ linker_so = self.linker_so
528
+ if linker_so:
529
+ linker_so_flags = self.flag_vars.linker_so
530
+ if sys.platform.startswith('aix'):
531
+ python_lib = get_python_lib(standard_lib=1)
532
+ ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix')
533
+ python_exp = os.path.join(python_lib, 'config', 'python.exp')
534
+ linker_so = [ld_so_aix] + linker_so + ['-bI:'+python_exp]
535
+ if sys.platform.startswith('os400'):
536
+ from distutils.sysconfig import get_config_var
537
+ python_config = get_config_var('LIBPL')
538
+ ld_so_aix = os.path.join(python_config, 'ld_so_aix')
539
+ python_exp = os.path.join(python_config, 'python.exp')
540
+ linker_so = [ld_so_aix] + linker_so + ['-bI:'+python_exp]
541
+ self.set_commands(linker_so=linker_so+linker_so_flags)
542
+
543
+ linker_exe = self.linker_exe
544
+ if linker_exe:
545
+ linker_exe_flags = self.flag_vars.linker_exe
546
+ self.set_commands(linker_exe=linker_exe+linker_exe_flags)
547
+
548
+ ar = self.command_vars.archiver
549
+ if ar:
550
+ arflags = self.flag_vars.ar
551
+ self.set_commands(archiver=[ar]+arflags)
552
+
553
+ self.set_library_dirs(self.get_library_dirs())
554
+ self.set_libraries(self.get_libraries())
555
+
556
+ def dump_properties(self):
557
+ """Print out the attributes of a compiler instance."""
558
+ props = []
559
+ for key in list(self.executables.keys()) + \
560
+ ['version', 'libraries', 'library_dirs',
561
+ 'object_switch', 'compile_switch']:
562
+ if hasattr(self, key):
563
+ v = getattr(self, key)
564
+ props.append((key, None, '= '+repr(v)))
565
+ props.sort()
566
+
567
+ pretty_printer = FancyGetopt(props)
568
+ for l in pretty_printer.generate_help("%s instance properties:" \
569
+ % (self.__class__.__name__)):
570
+ if l[:4]==' --':
571
+ l = ' ' + l[4:]
572
+ print(l)
573
+
574
+ ###################
575
+
576
+ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
577
+ """Compile 'src' to product 'obj'."""
578
+ src_flags = {}
579
+ if Path(src).suffix.lower() in FORTRAN_COMMON_FIXED_EXTENSIONS \
580
+ and not has_f90_header(src):
581
+ flavor = ':f77'
582
+ compiler = self.compiler_f77
583
+ src_flags = get_f77flags(src)
584
+ extra_compile_args = self.extra_f77_compile_args or []
585
+ elif is_free_format(src):
586
+ flavor = ':f90'
587
+ compiler = self.compiler_f90
588
+ if compiler is None:
589
+ raise DistutilsExecError('f90 not supported by %s needed for %s'\
590
+ % (self.__class__.__name__, src))
591
+ extra_compile_args = self.extra_f90_compile_args or []
592
+ else:
593
+ flavor = ':fix'
594
+ compiler = self.compiler_fix
595
+ if compiler is None:
596
+ raise DistutilsExecError('f90 (fixed) not supported by %s needed for %s'\
597
+ % (self.__class__.__name__, src))
598
+ extra_compile_args = self.extra_f90_compile_args or []
599
+ if self.object_switch[-1]==' ':
600
+ o_args = [self.object_switch.strip(), obj]
601
+ else:
602
+ o_args = [self.object_switch.strip()+obj]
603
+
604
+ assert self.compile_switch.strip()
605
+ s_args = [self.compile_switch, src]
606
+
607
+ if extra_compile_args:
608
+ log.info('extra %s options: %r' \
609
+ % (flavor[1:], ' '.join(extra_compile_args)))
610
+
611
+ extra_flags = src_flags.get(self.compiler_type, [])
612
+ if extra_flags:
613
+ log.info('using compile options from source: %r' \
614
+ % ' '.join(extra_flags))
615
+
616
+ command = compiler + cc_args + extra_flags + s_args + o_args \
617
+ + extra_postargs + extra_compile_args
618
+
619
+ display = '%s: %s' % (os.path.basename(compiler[0]) + flavor,
620
+ src)
621
+ try:
622
+ self.spawn(command, display=display)
623
+ except DistutilsExecError as e:
624
+ msg = str(e)
625
+ raise CompileError(msg) from None
626
+
627
+ def module_options(self, module_dirs, module_build_dir):
628
+ options = []
629
+ if self.module_dir_switch is not None:
630
+ if self.module_dir_switch[-1]==' ':
631
+ options.extend([self.module_dir_switch.strip(), module_build_dir])
632
+ else:
633
+ options.append(self.module_dir_switch.strip()+module_build_dir)
634
+ else:
635
+ print('XXX: module_build_dir=%r option ignored' % (module_build_dir))
636
+ print('XXX: Fix module_dir_switch for ', self.__class__.__name__)
637
+ if self.module_include_switch is not None:
638
+ for d in [module_build_dir]+module_dirs:
639
+ options.append('%s%s' % (self.module_include_switch, d))
640
+ else:
641
+ print('XXX: module_dirs=%r option ignored' % (module_dirs))
642
+ print('XXX: Fix module_include_switch for ', self.__class__.__name__)
643
+ return options
644
+
645
+ def library_option(self, lib):
646
+ return "-l" + lib
647
+ def library_dir_option(self, dir):
648
+ return "-L" + dir
649
+
650
+ def link(self, target_desc, objects,
651
+ output_filename, output_dir=None, libraries=None,
652
+ library_dirs=None, runtime_library_dirs=None,
653
+ export_symbols=None, debug=0, extra_preargs=None,
654
+ extra_postargs=None, build_temp=None, target_lang=None):
655
+ objects, output_dir = self._fix_object_args(objects, output_dir)
656
+ libraries, library_dirs, runtime_library_dirs = \
657
+ self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
658
+
659
+ lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs,
660
+ libraries)
661
+ if is_string(output_dir):
662
+ output_filename = os.path.join(output_dir, output_filename)
663
+ elif output_dir is not None:
664
+ raise TypeError("'output_dir' must be a string or None")
665
+
666
+ if self._need_link(objects, output_filename):
667
+ if self.library_switch[-1]==' ':
668
+ o_args = [self.library_switch.strip(), output_filename]
669
+ else:
670
+ o_args = [self.library_switch.strip()+output_filename]
671
+
672
+ if is_string(self.objects):
673
+ ld_args = objects + [self.objects]
674
+ else:
675
+ ld_args = objects + self.objects
676
+ ld_args = ld_args + lib_opts + o_args
677
+ if debug:
678
+ ld_args[:0] = ['-g']
679
+ if extra_preargs:
680
+ ld_args[:0] = extra_preargs
681
+ if extra_postargs:
682
+ ld_args.extend(extra_postargs)
683
+ self.mkpath(os.path.dirname(output_filename))
684
+ if target_desc == CCompiler.EXECUTABLE:
685
+ linker = self.linker_exe[:]
686
+ else:
687
+ linker = self.linker_so[:]
688
+ command = linker + ld_args
689
+ try:
690
+ self.spawn(command)
691
+ except DistutilsExecError as e:
692
+ msg = str(e)
693
+ raise LinkError(msg) from None
694
+ else:
695
+ log.debug("skipping %s (up-to-date)", output_filename)
696
+
697
+ def _environment_hook(self, name, hook_name):
698
+ if hook_name is None:
699
+ return None
700
+ if is_string(hook_name):
701
+ if hook_name.startswith('self.'):
702
+ hook_name = hook_name[5:]
703
+ hook = getattr(self, hook_name)
704
+ return hook()
705
+ elif hook_name.startswith('exe.'):
706
+ hook_name = hook_name[4:]
707
+ var = self.executables[hook_name]
708
+ if var:
709
+ return var[0]
710
+ else:
711
+ return None
712
+ elif hook_name.startswith('flags.'):
713
+ hook_name = hook_name[6:]
714
+ hook = getattr(self, 'get_flags_' + hook_name)
715
+ return hook()
716
+ else:
717
+ return hook_name()
718
+
719
+ def can_ccompiler_link(self, ccompiler):
720
+ """
721
+ Check if the given C compiler can link objects produced by
722
+ this compiler.
723
+ """
724
+ return True
725
+
726
+ def wrap_unlinkable_objects(self, objects, output_dir, extra_dll_dir):
727
+ """
728
+ Convert a set of object files that are not compatible with the default
729
+ linker, to a file that is compatible.
730
+
731
+ Parameters
732
+ ----------
733
+ objects : list
734
+ List of object files to include.
735
+ output_dir : str
736
+ Output directory to place generated object files.
737
+ extra_dll_dir : str
738
+ Output directory to place extra DLL files that need to be
739
+ included on Windows.
740
+
741
+ Returns
742
+ -------
743
+ converted_objects : list of str
744
+ List of converted object files.
745
+ Note that the number of output files is not necessarily
746
+ the same as inputs.
747
+
748
+ """
749
+ raise NotImplementedError()
750
+
751
+ ## class FCompiler
752
+
753
+ _default_compilers = (
754
+ # sys.platform mappings
755
+ ('win32', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95',
756
+ 'intelvem', 'intelem', 'flang')),
757
+ ('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')),
758
+ ('linux.*', ('arm', 'gnu95', 'intel', 'lahey', 'pg', 'nv', 'absoft', 'nag',
759
+ 'vast', 'compaq', 'intele', 'intelem', 'gnu', 'g95',
760
+ 'pathf95', 'nagfor', 'fujitsu')),
761
+ ('darwin.*', ('gnu95', 'nag', 'nagfor', 'absoft', 'ibm', 'intel', 'gnu',
762
+ 'g95', 'pg')),
763
+ ('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')),
764
+ ('irix.*', ('mips', 'gnu', 'gnu95',)),
765
+ ('aix.*', ('ibm', 'gnu', 'gnu95',)),
766
+ # os.name mappings
767
+ ('posix', ('gnu', 'gnu95',)),
768
+ ('nt', ('gnu', 'gnu95',)),
769
+ ('mac', ('gnu95', 'gnu', 'pg')),
770
+ )
771
+
772
+ fcompiler_class = None
773
+ fcompiler_aliases = None
774
+
775
+ def load_all_fcompiler_classes():
776
+ """Cache all the FCompiler classes found in modules in the
777
+ numpy.distutils.fcompiler package.
778
+ """
779
+ from glob import glob
780
+ global fcompiler_class, fcompiler_aliases
781
+ if fcompiler_class is not None:
782
+ return
783
+ pys = os.path.join(os.path.dirname(__file__), '*.py')
784
+ fcompiler_class = {}
785
+ fcompiler_aliases = {}
786
+ for fname in glob(pys):
787
+ module_name, ext = os.path.splitext(os.path.basename(fname))
788
+ module_name = 'numpy.distutils.fcompiler.' + module_name
789
+ __import__ (module_name)
790
+ module = sys.modules[module_name]
791
+ if hasattr(module, 'compilers'):
792
+ for cname in module.compilers:
793
+ klass = getattr(module, cname)
794
+ desc = (klass.compiler_type, klass, klass.description)
795
+ fcompiler_class[klass.compiler_type] = desc
796
+ for alias in klass.compiler_aliases:
797
+ if alias in fcompiler_aliases:
798
+ raise ValueError("alias %r defined for both %s and %s"
799
+ % (alias, klass.__name__,
800
+ fcompiler_aliases[alias][1].__name__))
801
+ fcompiler_aliases[alias] = desc
802
+
803
+ def _find_existing_fcompiler(compiler_types,
804
+ osname=None, platform=None,
805
+ requiref90=False,
806
+ c_compiler=None):
807
+ from numpy.distutils.core import get_distribution
808
+ dist = get_distribution(always=True)
809
+ for compiler_type in compiler_types:
810
+ v = None
811
+ try:
812
+ c = new_fcompiler(plat=platform, compiler=compiler_type,
813
+ c_compiler=c_compiler)
814
+ c.customize(dist)
815
+ v = c.get_version()
816
+ if requiref90 and c.compiler_f90 is None:
817
+ v = None
818
+ new_compiler = c.suggested_f90_compiler
819
+ if new_compiler:
820
+ log.warn('Trying %r compiler as suggested by %r '
821
+ 'compiler for f90 support.' % (compiler_type,
822
+ new_compiler))
823
+ c = new_fcompiler(plat=platform, compiler=new_compiler,
824
+ c_compiler=c_compiler)
825
+ c.customize(dist)
826
+ v = c.get_version()
827
+ if v is not None:
828
+ compiler_type = new_compiler
829
+ if requiref90 and c.compiler_f90 is None:
830
+ raise ValueError('%s does not support compiling f90 codes, '
831
+ 'skipping.' % (c.__class__.__name__))
832
+ except DistutilsModuleError:
833
+ log.debug("_find_existing_fcompiler: compiler_type='%s' raised DistutilsModuleError", compiler_type)
834
+ except CompilerNotFound:
835
+ log.debug("_find_existing_fcompiler: compiler_type='%s' not found", compiler_type)
836
+ if v is not None:
837
+ return compiler_type
838
+ return None
839
+
840
+ def available_fcompilers_for_platform(osname=None, platform=None):
841
+ if osname is None:
842
+ osname = os.name
843
+ if platform is None:
844
+ platform = sys.platform
845
+ matching_compiler_types = []
846
+ for pattern, compiler_type in _default_compilers:
847
+ if re.match(pattern, platform) or re.match(pattern, osname):
848
+ for ct in compiler_type:
849
+ if ct not in matching_compiler_types:
850
+ matching_compiler_types.append(ct)
851
+ if not matching_compiler_types:
852
+ matching_compiler_types.append('gnu')
853
+ return matching_compiler_types
854
+
855
+ def get_default_fcompiler(osname=None, platform=None, requiref90=False,
856
+ c_compiler=None):
857
+ """Determine the default Fortran compiler to use for the given
858
+ platform."""
859
+ matching_compiler_types = available_fcompilers_for_platform(osname,
860
+ platform)
861
+ log.info("get_default_fcompiler: matching types: '%s'",
862
+ matching_compiler_types)
863
+ compiler_type = _find_existing_fcompiler(matching_compiler_types,
864
+ osname=osname,
865
+ platform=platform,
866
+ requiref90=requiref90,
867
+ c_compiler=c_compiler)
868
+ return compiler_type
869
+
870
+ # Flag to avoid rechecking for Fortran compiler every time
871
+ failed_fcompilers = set()
872
+
873
+ def new_fcompiler(plat=None,
874
+ compiler=None,
875
+ verbose=0,
876
+ dry_run=0,
877
+ force=0,
878
+ requiref90=False,
879
+ c_compiler = None):
880
+ """Generate an instance of some FCompiler subclass for the supplied
881
+ platform/compiler combination.
882
+ """
883
+ global failed_fcompilers
884
+ fcompiler_key = (plat, compiler)
885
+ if fcompiler_key in failed_fcompilers:
886
+ return None
887
+
888
+ load_all_fcompiler_classes()
889
+ if plat is None:
890
+ plat = os.name
891
+ if compiler is None:
892
+ compiler = get_default_fcompiler(plat, requiref90=requiref90,
893
+ c_compiler=c_compiler)
894
+ if compiler in fcompiler_class:
895
+ module_name, klass, long_description = fcompiler_class[compiler]
896
+ elif compiler in fcompiler_aliases:
897
+ module_name, klass, long_description = fcompiler_aliases[compiler]
898
+ else:
899
+ msg = "don't know how to compile Fortran code on platform '%s'" % plat
900
+ if compiler is not None:
901
+ msg = msg + " with '%s' compiler." % compiler
902
+ msg = msg + " Supported compilers are: %s)" \
903
+ % (','.join(fcompiler_class.keys()))
904
+ log.warn(msg)
905
+ failed_fcompilers.add(fcompiler_key)
906
+ return None
907
+
908
+ compiler = klass(verbose=verbose, dry_run=dry_run, force=force)
909
+ compiler.c_compiler = c_compiler
910
+ return compiler
911
+
912
+ def show_fcompilers(dist=None):
913
+ """Print list of available compilers (used by the "--help-fcompiler"
914
+ option to "config_fc").
915
+ """
916
+ if dist is None:
917
+ from distutils.dist import Distribution
918
+ from numpy.distutils.command.config_compiler import config_fc
919
+ dist = Distribution()
920
+ dist.script_name = os.path.basename(sys.argv[0])
921
+ dist.script_args = ['config_fc'] + sys.argv[1:]
922
+ try:
923
+ dist.script_args.remove('--help-fcompiler')
924
+ except ValueError:
925
+ pass
926
+ dist.cmdclass['config_fc'] = config_fc
927
+ dist.parse_config_files()
928
+ dist.parse_command_line()
929
+ compilers = []
930
+ compilers_na = []
931
+ compilers_ni = []
932
+ if not fcompiler_class:
933
+ load_all_fcompiler_classes()
934
+ platform_compilers = available_fcompilers_for_platform()
935
+ for compiler in platform_compilers:
936
+ v = None
937
+ log.set_verbosity(-2)
938
+ try:
939
+ c = new_fcompiler(compiler=compiler, verbose=dist.verbose)
940
+ c.customize(dist)
941
+ v = c.get_version()
942
+ except (DistutilsModuleError, CompilerNotFound) as e:
943
+ log.debug("show_fcompilers: %s not found" % (compiler,))
944
+ log.debug(repr(e))
945
+
946
+ if v is None:
947
+ compilers_na.append(("fcompiler="+compiler, None,
948
+ fcompiler_class[compiler][2]))
949
+ else:
950
+ c.dump_properties()
951
+ compilers.append(("fcompiler="+compiler, None,
952
+ fcompiler_class[compiler][2] + ' (%s)' % v))
953
+
954
+ compilers_ni = list(set(fcompiler_class.keys()) - set(platform_compilers))
955
+ compilers_ni = [("fcompiler="+fc, None, fcompiler_class[fc][2])
956
+ for fc in compilers_ni]
957
+
958
+ compilers.sort()
959
+ compilers_na.sort()
960
+ compilers_ni.sort()
961
+ pretty_printer = FancyGetopt(compilers)
962
+ pretty_printer.print_help("Fortran compilers found:")
963
+ pretty_printer = FancyGetopt(compilers_na)
964
+ pretty_printer.print_help("Compilers available for this "
965
+ "platform, but not found:")
966
+ if compilers_ni:
967
+ pretty_printer = FancyGetopt(compilers_ni)
968
+ pretty_printer.print_help("Compilers not available on this platform:")
969
+ print("For compiler details, run 'config_fc --verbose' setup command.")
970
+
971
+
972
+ def dummy_fortran_file():
973
+ fo, name = make_temp_file(suffix='.f')
974
+ fo.write(" subroutine dummy()\n end\n")
975
+ fo.close()
976
+ return name[:-2]
977
+
978
+
979
+ _has_f_header = re.compile(r'-\*-\s*fortran\s*-\*-', re.I).search
980
+ _has_f90_header = re.compile(r'-\*-\s*f90\s*-\*-', re.I).search
981
+ _has_fix_header = re.compile(r'-\*-\s*fix\s*-\*-', re.I).search
982
+ _free_f90_start = re.compile(r'[^c*!]\s*[^\s\d\t]', re.I).match
983
+
984
+ def is_free_format(file):
985
+ """Check if file is in free format Fortran."""
986
+ # f90 allows both fixed and free format, assuming fixed unless
987
+ # signs of free format are detected.
988
+ result = 0
989
+ with open(file, encoding='latin1') as f:
990
+ line = f.readline()
991
+ n = 10000 # the number of non-comment lines to scan for hints
992
+ if _has_f_header(line) or _has_fix_header(line):
993
+ n = 0
994
+ elif _has_f90_header(line):
995
+ n = 0
996
+ result = 1
997
+ while n>0 and line:
998
+ line = line.rstrip()
999
+ if line and line[0]!='!':
1000
+ n -= 1
1001
+ if (line[0]!='\t' and _free_f90_start(line[:5])) or line[-1:]=='&':
1002
+ result = 1
1003
+ break
1004
+ line = f.readline()
1005
+ return result
1006
+
1007
+ def has_f90_header(src):
1008
+ with open(src, encoding='latin1') as f:
1009
+ line = f.readline()
1010
+ return _has_f90_header(line) or _has_fix_header(line)
1011
+
1012
+ _f77flags_re = re.compile(r'(c|)f77flags\s*\(\s*(?P<fcname>\w+)\s*\)\s*=\s*(?P<fflags>.*)', re.I)
1013
+ def get_f77flags(src):
1014
+ """
1015
+ Search the first 20 lines of fortran 77 code for line pattern
1016
+ `CF77FLAGS(<fcompiler type>)=<f77 flags>`
1017
+ Return a dictionary {<fcompiler type>:<f77 flags>}.
1018
+ """
1019
+ flags = {}
1020
+ with open(src, encoding='latin1') as f:
1021
+ i = 0
1022
+ for line in f:
1023
+ i += 1
1024
+ if i>20: break
1025
+ m = _f77flags_re.match(line)
1026
+ if not m: continue
1027
+ fcname = m.group('fcname').strip()
1028
+ fflags = m.group('fflags').strip()
1029
+ flags[fcname] = split_quoted(fflags)
1030
+ return flags
1031
+
1032
+ # TODO: implement get_f90flags and use it in _compile similarly to get_f77flags
1033
+
1034
+ if __name__ == '__main__':
1035
+ show_fcompilers()
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/absoft.cpython-311.pyc ADDED
Binary file (7.36 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/arm.cpython-311.pyc ADDED
Binary file (3.72 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/compaq.cpython-311.pyc ADDED
Binary file (5.68 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/environment.cpython-311.pyc ADDED
Binary file (5 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/fujitsu.cpython-311.pyc ADDED
Binary file (2.34 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/g95.cpython-311.pyc ADDED
Binary file (1.95 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/gnu.cpython-311.pyc ADDED
Binary file (24.9 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/hpux.cpython-311.pyc ADDED
Binary file (2.36 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/ibm.cpython-311.pyc ADDED
Binary file (5.89 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/lahey.cpython-311.pyc ADDED
Binary file (2.54 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/nag.cpython-311.pyc ADDED
Binary file (4.55 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/nv.cpython-311.pyc ADDED
Binary file (2.74 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/pg.cpython-311.pyc ADDED
Binary file (5.71 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/__pycache__/vast.cpython-311.pyc ADDED
Binary file (2.7 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/absoft.py ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Absoft Corporation ceased operations on 12/31/2022.
3
+ # Thus, all links to <http://www.absoft.com> are invalid.
4
+
5
+ # Notes:
6
+ # - when using -g77 then use -DUNDERSCORE_G77 to compile f2py
7
+ # generated extension modules (works for f2py v2.45.241_1936 and up)
8
+ import os
9
+
10
+ from numpy.distutils.cpuinfo import cpu
11
+ from numpy.distutils.fcompiler import FCompiler, dummy_fortran_file
12
+ from numpy.distutils.misc_util import cyg2win32
13
+
14
+ compilers = ['AbsoftFCompiler']
15
+
16
+ class AbsoftFCompiler(FCompiler):
17
+
18
+ compiler_type = 'absoft'
19
+ description = 'Absoft Corp Fortran Compiler'
20
+ #version_pattern = r'FORTRAN 77 Compiler (?P<version>[^\s*,]*).*?Absoft Corp'
21
+ version_pattern = r'(f90:.*?(Absoft Pro FORTRAN Version|FORTRAN 77 Compiler|Absoft Fortran Compiler Version|Copyright Absoft Corporation.*?Version))'+\
22
+ r' (?P<version>[^\s*,]*)(.*?Absoft Corp|)'
23
+
24
+ # on windows: f90 -V -c dummy.f
25
+ # f90: Copyright Absoft Corporation 1994-1998 mV2; Cray Research, Inc. 1994-1996 CF90 (2.x.x.x f36t87) Version 2.3 Wed Apr 19, 2006 13:05:16
26
+
27
+ # samt5735(8)$ f90 -V -c dummy.f
28
+ # f90: Copyright Absoft Corporation 1994-2002; Absoft Pro FORTRAN Version 8.0
29
+ # Note that fink installs g77 as f77, so need to use f90 for detection.
30
+
31
+ executables = {
32
+ 'version_cmd' : None, # set by update_executables
33
+ 'compiler_f77' : ["f77"],
34
+ 'compiler_fix' : ["f90"],
35
+ 'compiler_f90' : ["f90"],
36
+ 'linker_so' : ["<F90>"],
37
+ 'archiver' : ["ar", "-cr"],
38
+ 'ranlib' : ["ranlib"]
39
+ }
40
+
41
+ if os.name=='nt':
42
+ library_switch = '/out:' #No space after /out:!
43
+
44
+ module_dir_switch = None
45
+ module_include_switch = '-p'
46
+
47
+ def update_executables(self):
48
+ f = cyg2win32(dummy_fortran_file())
49
+ self.executables['version_cmd'] = ['<F90>', '-V', '-c',
50
+ f+'.f', '-o', f+'.o']
51
+
52
+ def get_flags_linker_so(self):
53
+ if os.name=='nt':
54
+ opt = ['/dll']
55
+ # The "-K shared" switches are being left in for pre-9.0 versions
56
+ # of Absoft though I don't think versions earlier than 9 can
57
+ # actually be used to build shared libraries. In fact, version
58
+ # 8 of Absoft doesn't recognize "-K shared" and will fail.
59
+ elif self.get_version() >= '9.0':
60
+ opt = ['-shared']
61
+ else:
62
+ opt = ["-K", "shared"]
63
+ return opt
64
+
65
+ def library_dir_option(self, dir):
66
+ if os.name=='nt':
67
+ return ['-link', '/PATH:%s' % (dir)]
68
+ return "-L" + dir
69
+
70
+ def library_option(self, lib):
71
+ if os.name=='nt':
72
+ return '%s.lib' % (lib)
73
+ return "-l" + lib
74
+
75
+ def get_library_dirs(self):
76
+ opt = FCompiler.get_library_dirs(self)
77
+ d = os.environ.get('ABSOFT')
78
+ if d:
79
+ if self.get_version() >= '10.0':
80
+ # use shared libraries, the static libraries were not compiled -fPIC
81
+ prefix = 'sh'
82
+ else:
83
+ prefix = ''
84
+ if cpu.is_64bit():
85
+ suffix = '64'
86
+ else:
87
+ suffix = ''
88
+ opt.append(os.path.join(d, '%slib%s' % (prefix, suffix)))
89
+ return opt
90
+
91
+ def get_libraries(self):
92
+ opt = FCompiler.get_libraries(self)
93
+ if self.get_version() >= '11.0':
94
+ opt.extend(['af90math', 'afio', 'af77math', 'amisc'])
95
+ elif self.get_version() >= '10.0':
96
+ opt.extend(['af90math', 'afio', 'af77math', 'U77'])
97
+ elif self.get_version() >= '8.0':
98
+ opt.extend(['f90math', 'fio', 'f77math', 'U77'])
99
+ else:
100
+ opt.extend(['fio', 'f90math', 'fmath', 'U77'])
101
+ if os.name =='nt':
102
+ opt.append('COMDLG32')
103
+ return opt
104
+
105
+ def get_flags(self):
106
+ opt = FCompiler.get_flags(self)
107
+ if os.name != 'nt':
108
+ opt.extend(['-s'])
109
+ if self.get_version():
110
+ if self.get_version()>='8.2':
111
+ opt.append('-fpic')
112
+ return opt
113
+
114
+ def get_flags_f77(self):
115
+ opt = FCompiler.get_flags_f77(self)
116
+ opt.extend(['-N22', '-N90', '-N110'])
117
+ v = self.get_version()
118
+ if os.name == 'nt':
119
+ if v and v>='8.0':
120
+ opt.extend(['-f', '-N15'])
121
+ else:
122
+ opt.append('-f')
123
+ if v:
124
+ if v<='4.6':
125
+ opt.append('-B108')
126
+ else:
127
+ # Though -N15 is undocumented, it works with
128
+ # Absoft 8.0 on Linux
129
+ opt.append('-N15')
130
+ return opt
131
+
132
+ def get_flags_f90(self):
133
+ opt = FCompiler.get_flags_f90(self)
134
+ opt.extend(["-YCFRL=1", "-YCOM_NAMES=LCS", "-YCOM_PFX", "-YEXT_PFX",
135
+ "-YCOM_SFX=_", "-YEXT_SFX=_", "-YEXT_NAMES=LCS"])
136
+ if self.get_version():
137
+ if self.get_version()>'4.6':
138
+ opt.extend(["-YDEALLOC=ALL"])
139
+ return opt
140
+
141
+ def get_flags_fix(self):
142
+ opt = FCompiler.get_flags_fix(self)
143
+ opt.extend(["-YCFRL=1", "-YCOM_NAMES=LCS", "-YCOM_PFX", "-YEXT_PFX",
144
+ "-YCOM_SFX=_", "-YEXT_SFX=_", "-YEXT_NAMES=LCS"])
145
+ opt.extend(["-f", "fixed"])
146
+ return opt
147
+
148
+ def get_flags_opt(self):
149
+ opt = ['-O']
150
+ return opt
151
+
152
+ if __name__ == '__main__':
153
+ from distutils import log
154
+ log.set_verbosity(2)
155
+ from numpy.distutils import customized_fcompiler
156
+ print(customized_fcompiler(compiler='absoft').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/arm.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+
3
+ from numpy.distutils.fcompiler import FCompiler, dummy_fortran_file
4
+ from sys import platform
5
+ from os.path import join, dirname, normpath
6
+
7
+ compilers = ['ArmFlangCompiler']
8
+
9
+ import functools
10
+
11
+ class ArmFlangCompiler(FCompiler):
12
+ compiler_type = 'arm'
13
+ description = 'Arm Compiler'
14
+ version_pattern = r'\s*Arm.*version (?P<version>[\d.-]+).*'
15
+
16
+ ar_exe = 'lib.exe'
17
+ possible_executables = ['armflang']
18
+
19
+ executables = {
20
+ 'version_cmd': ["", "--version"],
21
+ 'compiler_f77': ["armflang", "-fPIC"],
22
+ 'compiler_fix': ["armflang", "-fPIC", "-ffixed-form"],
23
+ 'compiler_f90': ["armflang", "-fPIC"],
24
+ 'linker_so': ["armflang", "-fPIC", "-shared"],
25
+ 'archiver': ["ar", "-cr"],
26
+ 'ranlib': None
27
+ }
28
+
29
+ pic_flags = ["-fPIC", "-DPIC"]
30
+ c_compiler = 'arm'
31
+ module_dir_switch = '-module ' # Don't remove ending space!
32
+
33
+ def get_libraries(self):
34
+ opt = FCompiler.get_libraries(self)
35
+ opt.extend(['flang', 'flangrti', 'ompstub'])
36
+ return opt
37
+
38
+ @functools.lru_cache(maxsize=128)
39
+ def get_library_dirs(self):
40
+ """List of compiler library directories."""
41
+ opt = FCompiler.get_library_dirs(self)
42
+ flang_dir = dirname(self.executables['compiler_f77'][0])
43
+ opt.append(normpath(join(flang_dir, '..', 'lib')))
44
+
45
+ return opt
46
+
47
+ def get_flags(self):
48
+ return []
49
+
50
+ def get_flags_free(self):
51
+ return []
52
+
53
+ def get_flags_debug(self):
54
+ return ['-g']
55
+
56
+ def get_flags_opt(self):
57
+ return ['-O3']
58
+
59
+ def get_flags_arch(self):
60
+ return []
61
+
62
+ def runtime_library_dir_option(self, dir):
63
+ return '-Wl,-rpath=%s' % dir
64
+
65
+
66
+ if __name__ == '__main__':
67
+ from distutils import log
68
+ log.set_verbosity(2)
69
+ from numpy.distutils import customized_fcompiler
70
+ print(customized_fcompiler(compiler='armflang').get_version())
71
+
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/compaq.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #http://www.compaq.com/fortran/docs/
3
+ import os
4
+ import sys
5
+
6
+ from numpy.distutils.fcompiler import FCompiler
7
+ from distutils.errors import DistutilsPlatformError
8
+
9
+ compilers = ['CompaqFCompiler']
10
+ if os.name != 'posix' or sys.platform[:6] == 'cygwin' :
11
+ # Otherwise we'd get a false positive on posix systems with
12
+ # case-insensitive filesystems (like darwin), because we'll pick
13
+ # up /bin/df
14
+ compilers.append('CompaqVisualFCompiler')
15
+
16
+ class CompaqFCompiler(FCompiler):
17
+
18
+ compiler_type = 'compaq'
19
+ description = 'Compaq Fortran Compiler'
20
+ version_pattern = r'Compaq Fortran (?P<version>[^\s]*).*'
21
+
22
+ if sys.platform[:5]=='linux':
23
+ fc_exe = 'fort'
24
+ else:
25
+ fc_exe = 'f90'
26
+
27
+ executables = {
28
+ 'version_cmd' : ['<F90>', "-version"],
29
+ 'compiler_f77' : [fc_exe, "-f77rtl", "-fixed"],
30
+ 'compiler_fix' : [fc_exe, "-fixed"],
31
+ 'compiler_f90' : [fc_exe],
32
+ 'linker_so' : ['<F90>'],
33
+ 'archiver' : ["ar", "-cr"],
34
+ 'ranlib' : ["ranlib"]
35
+ }
36
+
37
+ module_dir_switch = '-module ' # not tested
38
+ module_include_switch = '-I'
39
+
40
+ def get_flags(self):
41
+ return ['-assume no2underscore', '-nomixed_str_len_arg']
42
+ def get_flags_debug(self):
43
+ return ['-g', '-check bounds']
44
+ def get_flags_opt(self):
45
+ return ['-O4', '-align dcommons', '-assume bigarrays',
46
+ '-assume nozsize', '-math_library fast']
47
+ def get_flags_arch(self):
48
+ return ['-arch host', '-tune host']
49
+ def get_flags_linker_so(self):
50
+ if sys.platform[:5]=='linux':
51
+ return ['-shared']
52
+ return ['-shared', '-Wl,-expect_unresolved,*']
53
+
54
+ class CompaqVisualFCompiler(FCompiler):
55
+
56
+ compiler_type = 'compaqv'
57
+ description = 'DIGITAL or Compaq Visual Fortran Compiler'
58
+ version_pattern = (r'(DIGITAL|Compaq) Visual Fortran Optimizing Compiler'
59
+ r' Version (?P<version>[^\s]*).*')
60
+
61
+ compile_switch = '/compile_only'
62
+ object_switch = '/object:'
63
+ library_switch = '/OUT:' #No space after /OUT:!
64
+
65
+ static_lib_extension = ".lib"
66
+ static_lib_format = "%s%s"
67
+ module_dir_switch = '/module:'
68
+ module_include_switch = '/I'
69
+
70
+ ar_exe = 'lib.exe'
71
+ fc_exe = 'DF'
72
+
73
+ if sys.platform=='win32':
74
+ from numpy.distutils.msvccompiler import MSVCCompiler
75
+
76
+ try:
77
+ m = MSVCCompiler()
78
+ m.initialize()
79
+ ar_exe = m.lib
80
+ except DistutilsPlatformError:
81
+ pass
82
+ except AttributeError as e:
83
+ if '_MSVCCompiler__root' in str(e):
84
+ print('Ignoring "%s" (I think it is msvccompiler.py bug)' % (e))
85
+ else:
86
+ raise
87
+ except OSError as e:
88
+ if not "vcvarsall.bat" in str(e):
89
+ print("Unexpected OSError in", __file__)
90
+ raise
91
+ except ValueError as e:
92
+ if not "'path'" in str(e):
93
+ print("Unexpected ValueError in", __file__)
94
+ raise
95
+
96
+ executables = {
97
+ 'version_cmd' : ['<F90>', "/what"],
98
+ 'compiler_f77' : [fc_exe, "/f77rtl", "/fixed"],
99
+ 'compiler_fix' : [fc_exe, "/fixed"],
100
+ 'compiler_f90' : [fc_exe],
101
+ 'linker_so' : ['<F90>'],
102
+ 'archiver' : [ar_exe, "/OUT:"],
103
+ 'ranlib' : None
104
+ }
105
+
106
+ def get_flags(self):
107
+ return ['/nologo', '/MD', '/WX', '/iface=(cref,nomixed_str_len_arg)',
108
+ '/names:lowercase', '/assume:underscore']
109
+ def get_flags_opt(self):
110
+ return ['/Ox', '/fast', '/optimize:5', '/unroll:0', '/math_library:fast']
111
+ def get_flags_arch(self):
112
+ return ['/threads']
113
+ def get_flags_debug(self):
114
+ return ['/debug']
115
+
116
+ if __name__ == '__main__':
117
+ from distutils import log
118
+ log.set_verbosity(2)
119
+ from numpy.distutils import customized_fcompiler
120
+ print(customized_fcompiler(compiler='compaq').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/environment.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from distutils.dist import Distribution
3
+
4
+ __metaclass__ = type
5
+
6
+ class EnvironmentConfig:
7
+ def __init__(self, distutils_section='ALL', **kw):
8
+ self._distutils_section = distutils_section
9
+ self._conf_keys = kw
10
+ self._conf = None
11
+ self._hook_handler = None
12
+
13
+ def dump_variable(self, name):
14
+ conf_desc = self._conf_keys[name]
15
+ hook, envvar, confvar, convert, append = conf_desc
16
+ if not convert:
17
+ convert = lambda x : x
18
+ print('%s.%s:' % (self._distutils_section, name))
19
+ v = self._hook_handler(name, hook)
20
+ print(' hook : %s' % (convert(v),))
21
+ if envvar:
22
+ v = os.environ.get(envvar, None)
23
+ print(' environ: %s' % (convert(v),))
24
+ if confvar and self._conf:
25
+ v = self._conf.get(confvar, (None, None))[1]
26
+ print(' config : %s' % (convert(v),))
27
+
28
+ def dump_variables(self):
29
+ for name in self._conf_keys:
30
+ self.dump_variable(name)
31
+
32
+ def __getattr__(self, name):
33
+ try:
34
+ conf_desc = self._conf_keys[name]
35
+ except KeyError:
36
+ raise AttributeError(
37
+ f"'EnvironmentConfig' object has no attribute '{name}'"
38
+ ) from None
39
+
40
+ return self._get_var(name, conf_desc)
41
+
42
+ def get(self, name, default=None):
43
+ try:
44
+ conf_desc = self._conf_keys[name]
45
+ except KeyError:
46
+ return default
47
+ var = self._get_var(name, conf_desc)
48
+ if var is None:
49
+ var = default
50
+ return var
51
+
52
+ def _get_var(self, name, conf_desc):
53
+ hook, envvar, confvar, convert, append = conf_desc
54
+ if convert is None:
55
+ convert = lambda x: x
56
+ var = self._hook_handler(name, hook)
57
+ if envvar is not None:
58
+ envvar_contents = os.environ.get(envvar)
59
+ if envvar_contents is not None:
60
+ envvar_contents = convert(envvar_contents)
61
+ if var and append:
62
+ if os.environ.get('NPY_DISTUTILS_APPEND_FLAGS', '1') == '1':
63
+ var.extend(envvar_contents)
64
+ else:
65
+ # NPY_DISTUTILS_APPEND_FLAGS was explicitly set to 0
66
+ # to keep old (overwrite flags rather than append to
67
+ # them) behavior
68
+ var = envvar_contents
69
+ else:
70
+ var = envvar_contents
71
+ if confvar is not None and self._conf:
72
+ if confvar in self._conf:
73
+ source, confvar_contents = self._conf[confvar]
74
+ var = convert(confvar_contents)
75
+ return var
76
+
77
+
78
+ def clone(self, hook_handler):
79
+ ec = self.__class__(distutils_section=self._distutils_section,
80
+ **self._conf_keys)
81
+ ec._hook_handler = hook_handler
82
+ return ec
83
+
84
+ def use_distribution(self, dist):
85
+ if isinstance(dist, Distribution):
86
+ self._conf = dist.get_option_dict(self._distutils_section)
87
+ else:
88
+ self._conf = dist
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/fujitsu.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ fujitsu
3
+
4
+ Supports Fujitsu compiler function.
5
+ This compiler is developed by Fujitsu and is used in A64FX on Fugaku.
6
+ """
7
+ from numpy.distutils.fcompiler import FCompiler
8
+
9
+ compilers = ['FujitsuFCompiler']
10
+
11
+ class FujitsuFCompiler(FCompiler):
12
+ compiler_type = 'fujitsu'
13
+ description = 'Fujitsu Fortran Compiler'
14
+
15
+ possible_executables = ['frt']
16
+ version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
17
+ # $ frt --version
18
+ # frt (FRT) x.x.x yyyymmdd
19
+
20
+ executables = {
21
+ 'version_cmd' : ["<F77>", "--version"],
22
+ 'compiler_f77' : ["frt", "-Fixed"],
23
+ 'compiler_fix' : ["frt", "-Fixed"],
24
+ 'compiler_f90' : ["frt"],
25
+ 'linker_so' : ["frt", "-shared"],
26
+ 'archiver' : ["ar", "-cr"],
27
+ 'ranlib' : ["ranlib"]
28
+ }
29
+ pic_flags = ['-KPIC']
30
+ module_dir_switch = '-M'
31
+ module_include_switch = '-I'
32
+
33
+ def get_flags_opt(self):
34
+ return ['-O3']
35
+ def get_flags_debug(self):
36
+ return ['-g']
37
+ def runtime_library_dir_option(self, dir):
38
+ return f'-Wl,-rpath={dir}'
39
+ def get_libraries(self):
40
+ return ['fj90f', 'fj90i', 'fjsrcinfo']
41
+
42
+ if __name__ == '__main__':
43
+ from distutils import log
44
+ from numpy.distutils import customized_fcompiler
45
+ log.set_verbosity(2)
46
+ print(customized_fcompiler('fujitsu').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/g95.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # http://g95.sourceforge.net/
2
+ from numpy.distutils.fcompiler import FCompiler
3
+
4
+ compilers = ['G95FCompiler']
5
+
6
+ class G95FCompiler(FCompiler):
7
+ compiler_type = 'g95'
8
+ description = 'G95 Fortran Compiler'
9
+
10
+ # version_pattern = r'G95 \((GCC (?P<gccversion>[\d.]+)|.*?) \(g95!\) (?P<version>.*)\).*'
11
+ # $ g95 --version
12
+ # G95 (GCC 4.0.3 (g95!) May 22 2006)
13
+
14
+ version_pattern = r'G95 \((GCC (?P<gccversion>[\d.]+)|.*?) \(g95 (?P<version>.*)!\) (?P<date>.*)\).*'
15
+ # $ g95 --version
16
+ # G95 (GCC 4.0.3 (g95 0.90!) Aug 22 2006)
17
+
18
+ executables = {
19
+ 'version_cmd' : ["<F90>", "--version"],
20
+ 'compiler_f77' : ["g95", "-ffixed-form"],
21
+ 'compiler_fix' : ["g95", "-ffixed-form"],
22
+ 'compiler_f90' : ["g95"],
23
+ 'linker_so' : ["<F90>", "-shared"],
24
+ 'archiver' : ["ar", "-cr"],
25
+ 'ranlib' : ["ranlib"]
26
+ }
27
+ pic_flags = ['-fpic']
28
+ module_dir_switch = '-fmod='
29
+ module_include_switch = '-I'
30
+
31
+ def get_flags(self):
32
+ return ['-fno-second-underscore']
33
+ def get_flags_opt(self):
34
+ return ['-O']
35
+ def get_flags_debug(self):
36
+ return ['-g']
37
+
38
+ if __name__ == '__main__':
39
+ from distutils import log
40
+ from numpy.distutils import customized_fcompiler
41
+ log.set_verbosity(2)
42
+ print(customized_fcompiler('g95').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/gnu.py ADDED
@@ -0,0 +1,555 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import os
3
+ import sys
4
+ import warnings
5
+ import platform
6
+ import tempfile
7
+ import hashlib
8
+ import base64
9
+ import subprocess
10
+ from subprocess import Popen, PIPE, STDOUT
11
+ from numpy.distutils.exec_command import filepath_from_subprocess_output
12
+ from numpy.distutils.fcompiler import FCompiler
13
+ from distutils.version import LooseVersion
14
+
15
+ compilers = ['GnuFCompiler', 'Gnu95FCompiler']
16
+
17
+ TARGET_R = re.compile(r"Target: ([a-zA-Z0-9_\-]*)")
18
+
19
+ # XXX: handle cross compilation
20
+
21
+
22
+ def is_win64():
23
+ return sys.platform == "win32" and platform.architecture()[0] == "64bit"
24
+
25
+
26
+ class GnuFCompiler(FCompiler):
27
+ compiler_type = 'gnu'
28
+ compiler_aliases = ('g77', )
29
+ description = 'GNU Fortran 77 compiler'
30
+
31
+ def gnu_version_match(self, version_string):
32
+ """Handle the different versions of GNU fortran compilers"""
33
+ # Strip warning(s) that may be emitted by gfortran
34
+ while version_string.startswith('gfortran: warning'):
35
+ version_string =\
36
+ version_string[version_string.find('\n') + 1:].strip()
37
+
38
+ # Gfortran versions from after 2010 will output a simple string
39
+ # (usually "x.y", "x.y.z" or "x.y.z-q") for ``-dumpversion``; older
40
+ # gfortrans may still return long version strings (``-dumpversion`` was
41
+ # an alias for ``--version``)
42
+ if len(version_string) <= 20:
43
+ # Try to find a valid version string
44
+ m = re.search(r'([0-9.]+)', version_string)
45
+ if m:
46
+ # g77 provides a longer version string that starts with GNU
47
+ # Fortran
48
+ if version_string.startswith('GNU Fortran'):
49
+ return ('g77', m.group(1))
50
+
51
+ # gfortran only outputs a version string such as #.#.#, so check
52
+ # if the match is at the start of the string
53
+ elif m.start() == 0:
54
+ return ('gfortran', m.group(1))
55
+ else:
56
+ # Output probably from --version, try harder:
57
+ m = re.search(r'GNU Fortran\s+95.*?([0-9-.]+)', version_string)
58
+ if m:
59
+ return ('gfortran', m.group(1))
60
+ m = re.search(
61
+ r'GNU Fortran.*?\-?([0-9-.]+\.[0-9-.]+)', version_string)
62
+ if m:
63
+ v = m.group(1)
64
+ if v.startswith('0') or v.startswith('2') or v.startswith('3'):
65
+ # the '0' is for early g77's
66
+ return ('g77', v)
67
+ else:
68
+ # at some point in the 4.x series, the ' 95' was dropped
69
+ # from the version string
70
+ return ('gfortran', v)
71
+
72
+ # If still nothing, raise an error to make the problem easy to find.
73
+ err = 'A valid Fortran version was not found in this string:\n'
74
+ raise ValueError(err + version_string)
75
+
76
+ def version_match(self, version_string):
77
+ v = self.gnu_version_match(version_string)
78
+ if not v or v[0] != 'g77':
79
+ return None
80
+ return v[1]
81
+
82
+ possible_executables = ['g77', 'f77']
83
+ executables = {
84
+ 'version_cmd' : [None, "-dumpversion"],
85
+ 'compiler_f77' : [None, "-g", "-Wall", "-fno-second-underscore"],
86
+ 'compiler_f90' : None, # Use --fcompiler=gnu95 for f90 codes
87
+ 'compiler_fix' : None,
88
+ 'linker_so' : [None, "-g", "-Wall"],
89
+ 'archiver' : ["ar", "-cr"],
90
+ 'ranlib' : ["ranlib"],
91
+ 'linker_exe' : [None, "-g", "-Wall"]
92
+ }
93
+ module_dir_switch = None
94
+ module_include_switch = None
95
+
96
+ # Cygwin: f771: warning: -fPIC ignored for target (all code is
97
+ # position independent)
98
+ if os.name != 'nt' and sys.platform != 'cygwin':
99
+ pic_flags = ['-fPIC']
100
+
101
+ # use -mno-cygwin for g77 when Python is not Cygwin-Python
102
+ if sys.platform == 'win32':
103
+ for key in ['version_cmd', 'compiler_f77', 'linker_so', 'linker_exe']:
104
+ executables[key].append('-mno-cygwin')
105
+
106
+ g2c = 'g2c'
107
+ suggested_f90_compiler = 'gnu95'
108
+
109
+ def get_flags_linker_so(self):
110
+ opt = self.linker_so[1:]
111
+ if sys.platform == 'darwin':
112
+ target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None)
113
+ # If MACOSX_DEPLOYMENT_TARGET is set, we simply trust the value
114
+ # and leave it alone. But, distutils will complain if the
115
+ # environment's value is different from the one in the Python
116
+ # Makefile used to build Python. We let distutils handle this
117
+ # error checking.
118
+ if not target:
119
+ # If MACOSX_DEPLOYMENT_TARGET is not set in the environment,
120
+ # we try to get it first from sysconfig and then
121
+ # fall back to setting it to 10.9 This is a reasonable default
122
+ # even when using the official Python dist and those derived
123
+ # from it.
124
+ import sysconfig
125
+ target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
126
+ if not target:
127
+ target = '10.9'
128
+ s = f'Env. variable MACOSX_DEPLOYMENT_TARGET set to {target}'
129
+ warnings.warn(s, stacklevel=2)
130
+ os.environ['MACOSX_DEPLOYMENT_TARGET'] = str(target)
131
+ opt.extend(['-undefined', 'dynamic_lookup', '-bundle'])
132
+ else:
133
+ opt.append("-shared")
134
+ if sys.platform.startswith('sunos'):
135
+ # SunOS often has dynamically loaded symbols defined in the
136
+ # static library libg2c.a The linker doesn't like this. To
137
+ # ignore the problem, use the -mimpure-text flag. It isn't
138
+ # the safest thing, but seems to work. 'man gcc' says:
139
+ # ".. Instead of using -mimpure-text, you should compile all
140
+ # source code with -fpic or -fPIC."
141
+ opt.append('-mimpure-text')
142
+ return opt
143
+
144
+ def get_libgcc_dir(self):
145
+ try:
146
+ output = subprocess.check_output(self.compiler_f77 +
147
+ ['-print-libgcc-file-name'])
148
+ except (OSError, subprocess.CalledProcessError):
149
+ pass
150
+ else:
151
+ output = filepath_from_subprocess_output(output)
152
+ return os.path.dirname(output)
153
+ return None
154
+
155
+ def get_libgfortran_dir(self):
156
+ if sys.platform[:5] == 'linux':
157
+ libgfortran_name = 'libgfortran.so'
158
+ elif sys.platform == 'darwin':
159
+ libgfortran_name = 'libgfortran.dylib'
160
+ else:
161
+ libgfortran_name = None
162
+
163
+ libgfortran_dir = None
164
+ if libgfortran_name:
165
+ find_lib_arg = ['-print-file-name={0}'.format(libgfortran_name)]
166
+ try:
167
+ output = subprocess.check_output(
168
+ self.compiler_f77 + find_lib_arg)
169
+ except (OSError, subprocess.CalledProcessError):
170
+ pass
171
+ else:
172
+ output = filepath_from_subprocess_output(output)
173
+ libgfortran_dir = os.path.dirname(output)
174
+ return libgfortran_dir
175
+
176
+ def get_library_dirs(self):
177
+ opt = []
178
+ if sys.platform[:5] != 'linux':
179
+ d = self.get_libgcc_dir()
180
+ if d:
181
+ # if windows and not cygwin, libg2c lies in a different folder
182
+ if sys.platform == 'win32' and not d.startswith('/usr/lib'):
183
+ d = os.path.normpath(d)
184
+ path = os.path.join(d, "lib%s.a" % self.g2c)
185
+ if not os.path.exists(path):
186
+ root = os.path.join(d, *((os.pardir, ) * 4))
187
+ d2 = os.path.abspath(os.path.join(root, 'lib'))
188
+ path = os.path.join(d2, "lib%s.a" % self.g2c)
189
+ if os.path.exists(path):
190
+ opt.append(d2)
191
+ opt.append(d)
192
+ # For Macports / Linux, libgfortran and libgcc are not co-located
193
+ lib_gfortran_dir = self.get_libgfortran_dir()
194
+ if lib_gfortran_dir:
195
+ opt.append(lib_gfortran_dir)
196
+ return opt
197
+
198
+ def get_libraries(self):
199
+ opt = []
200
+ d = self.get_libgcc_dir()
201
+ if d is not None:
202
+ g2c = self.g2c + '-pic'
203
+ f = self.static_lib_format % (g2c, self.static_lib_extension)
204
+ if not os.path.isfile(os.path.join(d, f)):
205
+ g2c = self.g2c
206
+ else:
207
+ g2c = self.g2c
208
+
209
+ if g2c is not None:
210
+ opt.append(g2c)
211
+ c_compiler = self.c_compiler
212
+ if sys.platform == 'win32' and c_compiler and \
213
+ c_compiler.compiler_type == 'msvc':
214
+ opt.append('gcc')
215
+ if sys.platform == 'darwin':
216
+ opt.append('cc_dynamic')
217
+ return opt
218
+
219
+ def get_flags_debug(self):
220
+ return ['-g']
221
+
222
+ def get_flags_opt(self):
223
+ v = self.get_version()
224
+ if v and v <= '3.3.3':
225
+ # With this compiler version building Fortran BLAS/LAPACK
226
+ # with -O3 caused failures in lib.lapack heevr,syevr tests.
227
+ opt = ['-O2']
228
+ else:
229
+ opt = ['-O3']
230
+ opt.append('-funroll-loops')
231
+ return opt
232
+
233
+ def _c_arch_flags(self):
234
+ """ Return detected arch flags from CFLAGS """
235
+ import sysconfig
236
+ try:
237
+ cflags = sysconfig.get_config_vars()['CFLAGS']
238
+ except KeyError:
239
+ return []
240
+ arch_re = re.compile(r"-arch\s+(\w+)")
241
+ arch_flags = []
242
+ for arch in arch_re.findall(cflags):
243
+ arch_flags += ['-arch', arch]
244
+ return arch_flags
245
+
246
+ def get_flags_arch(self):
247
+ return []
248
+
249
+ def runtime_library_dir_option(self, dir):
250
+ if sys.platform == 'win32' or sys.platform == 'cygwin':
251
+ # Linux/Solaris/Unix support RPATH, Windows does not
252
+ raise NotImplementedError
253
+
254
+ # TODO: could use -Xlinker here, if it's supported
255
+ assert "," not in dir
256
+
257
+ if sys.platform == 'darwin':
258
+ return f'-Wl,-rpath,{dir}'
259
+ elif sys.platform.startswith(('aix', 'os400')):
260
+ # AIX RPATH is called LIBPATH
261
+ return f'-Wl,-blibpath:{dir}'
262
+ else:
263
+ return f'-Wl,-rpath={dir}'
264
+
265
+
266
+ class Gnu95FCompiler(GnuFCompiler):
267
+ compiler_type = 'gnu95'
268
+ compiler_aliases = ('gfortran', )
269
+ description = 'GNU Fortran 95 compiler'
270
+
271
+ def version_match(self, version_string):
272
+ v = self.gnu_version_match(version_string)
273
+ if not v or v[0] != 'gfortran':
274
+ return None
275
+ v = v[1]
276
+ if LooseVersion(v) >= "4":
277
+ # gcc-4 series releases do not support -mno-cygwin option
278
+ pass
279
+ else:
280
+ # use -mno-cygwin flag for gfortran when Python is not
281
+ # Cygwin-Python
282
+ if sys.platform == 'win32':
283
+ for key in [
284
+ 'version_cmd', 'compiler_f77', 'compiler_f90',
285
+ 'compiler_fix', 'linker_so', 'linker_exe'
286
+ ]:
287
+ self.executables[key].append('-mno-cygwin')
288
+ return v
289
+
290
+ possible_executables = ['gfortran', 'f95']
291
+ executables = {
292
+ 'version_cmd' : ["<F90>", "-dumpversion"],
293
+ 'compiler_f77' : [None, "-Wall", "-g", "-ffixed-form",
294
+ "-fno-second-underscore"],
295
+ 'compiler_f90' : [None, "-Wall", "-g",
296
+ "-fno-second-underscore"],
297
+ 'compiler_fix' : [None, "-Wall", "-g","-ffixed-form",
298
+ "-fno-second-underscore"],
299
+ 'linker_so' : ["<F90>", "-Wall", "-g"],
300
+ 'archiver' : ["ar", "-cr"],
301
+ 'ranlib' : ["ranlib"],
302
+ 'linker_exe' : [None, "-Wall"]
303
+ }
304
+
305
+ module_dir_switch = '-J'
306
+ module_include_switch = '-I'
307
+
308
+ if sys.platform.startswith(('aix', 'os400')):
309
+ executables['linker_so'].append('-lpthread')
310
+ if platform.architecture()[0][:2] == '64':
311
+ for key in ['compiler_f77', 'compiler_f90','compiler_fix','linker_so', 'linker_exe']:
312
+ executables[key].append('-maix64')
313
+
314
+ g2c = 'gfortran'
315
+
316
+ def _universal_flags(self, cmd):
317
+ """Return a list of -arch flags for every supported architecture."""
318
+ if not sys.platform == 'darwin':
319
+ return []
320
+ arch_flags = []
321
+ # get arches the C compiler gets.
322
+ c_archs = self._c_arch_flags()
323
+ if "i386" in c_archs:
324
+ c_archs[c_archs.index("i386")] = "i686"
325
+ # check the arches the Fortran compiler supports, and compare with
326
+ # arch flags from C compiler
327
+ for arch in ["ppc", "i686", "x86_64", "ppc64", "s390x"]:
328
+ if _can_target(cmd, arch) and arch in c_archs:
329
+ arch_flags.extend(["-arch", arch])
330
+ return arch_flags
331
+
332
+ def get_flags(self):
333
+ flags = GnuFCompiler.get_flags(self)
334
+ arch_flags = self._universal_flags(self.compiler_f90)
335
+ if arch_flags:
336
+ flags[:0] = arch_flags
337
+ return flags
338
+
339
+ def get_flags_linker_so(self):
340
+ flags = GnuFCompiler.get_flags_linker_so(self)
341
+ arch_flags = self._universal_flags(self.linker_so)
342
+ if arch_flags:
343
+ flags[:0] = arch_flags
344
+ return flags
345
+
346
+ def get_library_dirs(self):
347
+ opt = GnuFCompiler.get_library_dirs(self)
348
+ if sys.platform == 'win32':
349
+ c_compiler = self.c_compiler
350
+ if c_compiler and c_compiler.compiler_type == "msvc":
351
+ target = self.get_target()
352
+ if target:
353
+ d = os.path.normpath(self.get_libgcc_dir())
354
+ root = os.path.join(d, *((os.pardir, ) * 4))
355
+ path = os.path.join(root, "lib")
356
+ mingwdir = os.path.normpath(path)
357
+ if os.path.exists(os.path.join(mingwdir, "libmingwex.a")):
358
+ opt.append(mingwdir)
359
+ # For Macports / Linux, libgfortran and libgcc are not co-located
360
+ lib_gfortran_dir = self.get_libgfortran_dir()
361
+ if lib_gfortran_dir:
362
+ opt.append(lib_gfortran_dir)
363
+ return opt
364
+
365
+ def get_libraries(self):
366
+ opt = GnuFCompiler.get_libraries(self)
367
+ if sys.platform == 'darwin':
368
+ opt.remove('cc_dynamic')
369
+ if sys.platform == 'win32':
370
+ c_compiler = self.c_compiler
371
+ if c_compiler and c_compiler.compiler_type == "msvc":
372
+ if "gcc" in opt:
373
+ i = opt.index("gcc")
374
+ opt.insert(i + 1, "mingwex")
375
+ opt.insert(i + 1, "mingw32")
376
+ c_compiler = self.c_compiler
377
+ if c_compiler and c_compiler.compiler_type == "msvc":
378
+ return []
379
+ else:
380
+ pass
381
+ return opt
382
+
383
+ def get_target(self):
384
+ try:
385
+ p = subprocess.Popen(
386
+ self.compiler_f77 + ['-v'],
387
+ stdin=subprocess.PIPE,
388
+ stderr=subprocess.PIPE,
389
+ )
390
+ stdout, stderr = p.communicate()
391
+ output = (stdout or b"") + (stderr or b"")
392
+ except (OSError, subprocess.CalledProcessError):
393
+ pass
394
+ else:
395
+ output = filepath_from_subprocess_output(output)
396
+ m = TARGET_R.search(output)
397
+ if m:
398
+ return m.group(1)
399
+ return ""
400
+
401
+ def _hash_files(self, filenames):
402
+ h = hashlib.sha1()
403
+ for fn in filenames:
404
+ with open(fn, 'rb') as f:
405
+ while True:
406
+ block = f.read(131072)
407
+ if not block:
408
+ break
409
+ h.update(block)
410
+ text = base64.b32encode(h.digest())
411
+ text = text.decode('ascii')
412
+ return text.rstrip('=')
413
+
414
+ def _link_wrapper_lib(self, objects, output_dir, extra_dll_dir,
415
+ chained_dlls, is_archive):
416
+ """Create a wrapper shared library for the given objects
417
+
418
+ Return an MSVC-compatible lib
419
+ """
420
+
421
+ c_compiler = self.c_compiler
422
+ if c_compiler.compiler_type != "msvc":
423
+ raise ValueError("This method only supports MSVC")
424
+
425
+ object_hash = self._hash_files(list(objects) + list(chained_dlls))
426
+
427
+ if is_win64():
428
+ tag = 'win_amd64'
429
+ else:
430
+ tag = 'win32'
431
+
432
+ basename = 'lib' + os.path.splitext(
433
+ os.path.basename(objects[0]))[0][:8]
434
+ root_name = basename + '.' + object_hash + '.gfortran-' + tag
435
+ dll_name = root_name + '.dll'
436
+ def_name = root_name + '.def'
437
+ lib_name = root_name + '.lib'
438
+ dll_path = os.path.join(extra_dll_dir, dll_name)
439
+ def_path = os.path.join(output_dir, def_name)
440
+ lib_path = os.path.join(output_dir, lib_name)
441
+
442
+ if os.path.isfile(lib_path):
443
+ # Nothing to do
444
+ return lib_path, dll_path
445
+
446
+ if is_archive:
447
+ objects = (["-Wl,--whole-archive"] + list(objects) +
448
+ ["-Wl,--no-whole-archive"])
449
+ self.link_shared_object(
450
+ objects,
451
+ dll_name,
452
+ output_dir=extra_dll_dir,
453
+ extra_postargs=list(chained_dlls) + [
454
+ '-Wl,--allow-multiple-definition',
455
+ '-Wl,--output-def,' + def_path,
456
+ '-Wl,--export-all-symbols',
457
+ '-Wl,--enable-auto-import',
458
+ '-static',
459
+ '-mlong-double-64',
460
+ ])
461
+
462
+ # No PowerPC!
463
+ if is_win64():
464
+ specifier = '/MACHINE:X64'
465
+ else:
466
+ specifier = '/MACHINE:X86'
467
+
468
+ # MSVC specific code
469
+ lib_args = ['/def:' + def_path, '/OUT:' + lib_path, specifier]
470
+ if not c_compiler.initialized:
471
+ c_compiler.initialize()
472
+ c_compiler.spawn([c_compiler.lib] + lib_args)
473
+
474
+ return lib_path, dll_path
475
+
476
+ def can_ccompiler_link(self, compiler):
477
+ # MSVC cannot link objects compiled by GNU fortran
478
+ return compiler.compiler_type not in ("msvc", )
479
+
480
+ def wrap_unlinkable_objects(self, objects, output_dir, extra_dll_dir):
481
+ """
482
+ Convert a set of object files that are not compatible with the default
483
+ linker, to a file that is compatible.
484
+ """
485
+ if self.c_compiler.compiler_type == "msvc":
486
+ # Compile a DLL and return the lib for the DLL as
487
+ # the object. Also keep track of previous DLLs that
488
+ # we have compiled so that we can link against them.
489
+
490
+ # If there are .a archives, assume they are self-contained
491
+ # static libraries, and build separate DLLs for each
492
+ archives = []
493
+ plain_objects = []
494
+ for obj in objects:
495
+ if obj.lower().endswith('.a'):
496
+ archives.append(obj)
497
+ else:
498
+ plain_objects.append(obj)
499
+
500
+ chained_libs = []
501
+ chained_dlls = []
502
+ for archive in archives[::-1]:
503
+ lib, dll = self._link_wrapper_lib(
504
+ [archive],
505
+ output_dir,
506
+ extra_dll_dir,
507
+ chained_dlls=chained_dlls,
508
+ is_archive=True)
509
+ chained_libs.insert(0, lib)
510
+ chained_dlls.insert(0, dll)
511
+
512
+ if not plain_objects:
513
+ return chained_libs
514
+
515
+ lib, dll = self._link_wrapper_lib(
516
+ plain_objects,
517
+ output_dir,
518
+ extra_dll_dir,
519
+ chained_dlls=chained_dlls,
520
+ is_archive=False)
521
+ return [lib] + chained_libs
522
+ else:
523
+ raise ValueError("Unsupported C compiler")
524
+
525
+
526
+ def _can_target(cmd, arch):
527
+ """Return true if the architecture supports the -arch flag"""
528
+ newcmd = cmd[:]
529
+ fid, filename = tempfile.mkstemp(suffix=".f")
530
+ os.close(fid)
531
+ try:
532
+ d = os.path.dirname(filename)
533
+ output = os.path.splitext(filename)[0] + ".o"
534
+ try:
535
+ newcmd.extend(["-arch", arch, "-c", filename])
536
+ p = Popen(newcmd, stderr=STDOUT, stdout=PIPE, cwd=d)
537
+ p.communicate()
538
+ return p.returncode == 0
539
+ finally:
540
+ if os.path.exists(output):
541
+ os.remove(output)
542
+ finally:
543
+ os.remove(filename)
544
+
545
+
546
+ if __name__ == '__main__':
547
+ from distutils import log
548
+ from numpy.distutils import customized_fcompiler
549
+ log.set_verbosity(2)
550
+
551
+ print(customized_fcompiler('gnu').get_version())
552
+ try:
553
+ print(customized_fcompiler('g95').get_version())
554
+ except Exception as e:
555
+ print(e)
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/hpux.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy.distutils.fcompiler import FCompiler
2
+
3
+ compilers = ['HPUXFCompiler']
4
+
5
+ class HPUXFCompiler(FCompiler):
6
+
7
+ compiler_type = 'hpux'
8
+ description = 'HP Fortran 90 Compiler'
9
+ version_pattern = r'HP F90 (?P<version>[^\s*,]*)'
10
+
11
+ executables = {
12
+ 'version_cmd' : ["f90", "+version"],
13
+ 'compiler_f77' : ["f90"],
14
+ 'compiler_fix' : ["f90"],
15
+ 'compiler_f90' : ["f90"],
16
+ 'linker_so' : ["ld", "-b"],
17
+ 'archiver' : ["ar", "-cr"],
18
+ 'ranlib' : ["ranlib"]
19
+ }
20
+ module_dir_switch = None #XXX: fix me
21
+ module_include_switch = None #XXX: fix me
22
+ pic_flags = ['+Z']
23
+ def get_flags(self):
24
+ return self.pic_flags + ['+ppu', '+DD64']
25
+ def get_flags_opt(self):
26
+ return ['-O3']
27
+ def get_libraries(self):
28
+ return ['m']
29
+ def get_library_dirs(self):
30
+ opt = ['/usr/lib/hpux64']
31
+ return opt
32
+ def get_version(self, force=0, ok_status=[256, 0, 1]):
33
+ # XXX status==256 may indicate 'unrecognized option' or
34
+ # 'no input file'. So, version_cmd needs more work.
35
+ return FCompiler.get_version(self, force, ok_status)
36
+
37
+ if __name__ == '__main__':
38
+ from distutils import log
39
+ log.set_verbosity(10)
40
+ from numpy.distutils import customized_fcompiler
41
+ print(customized_fcompiler(compiler='hpux').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/ibm.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import re
3
+ import sys
4
+ import subprocess
5
+
6
+ from numpy.distutils.fcompiler import FCompiler
7
+ from numpy.distutils.exec_command import find_executable
8
+ from numpy.distutils.misc_util import make_temp_file
9
+ from distutils import log
10
+
11
+ compilers = ['IBMFCompiler']
12
+
13
+ class IBMFCompiler(FCompiler):
14
+ compiler_type = 'ibm'
15
+ description = 'IBM XL Fortran Compiler'
16
+ version_pattern = r'(xlf\(1\)\s*|)IBM XL Fortran ((Advanced Edition |)Version |Enterprise Edition V|for AIX, V)(?P<version>[^\s*]*)'
17
+ #IBM XL Fortran Enterprise Edition V10.1 for AIX \nVersion: 10.01.0000.0004
18
+
19
+ executables = {
20
+ 'version_cmd' : ["<F77>", "-qversion"],
21
+ 'compiler_f77' : ["xlf"],
22
+ 'compiler_fix' : ["xlf90", "-qfixed"],
23
+ 'compiler_f90' : ["xlf90"],
24
+ 'linker_so' : ["xlf95"],
25
+ 'archiver' : ["ar", "-cr"],
26
+ 'ranlib' : ["ranlib"]
27
+ }
28
+
29
+ def get_version(self,*args,**kwds):
30
+ version = FCompiler.get_version(self,*args,**kwds)
31
+
32
+ if version is None and sys.platform.startswith('aix'):
33
+ # use lslpp to find out xlf version
34
+ lslpp = find_executable('lslpp')
35
+ xlf = find_executable('xlf')
36
+ if os.path.exists(xlf) and os.path.exists(lslpp):
37
+ try:
38
+ o = subprocess.check_output([lslpp, '-Lc', 'xlfcmp'])
39
+ except (OSError, subprocess.CalledProcessError):
40
+ pass
41
+ else:
42
+ m = re.search(r'xlfcmp:(?P<version>\d+([.]\d+)+)', o)
43
+ if m: version = m.group('version')
44
+
45
+ xlf_dir = '/etc/opt/ibmcmp/xlf'
46
+ if version is None and os.path.isdir(xlf_dir):
47
+ # linux:
48
+ # If the output of xlf does not contain version info
49
+ # (that's the case with xlf 8.1, for instance) then
50
+ # let's try another method:
51
+ l = sorted(os.listdir(xlf_dir))
52
+ l.reverse()
53
+ l = [d for d in l if os.path.isfile(os.path.join(xlf_dir, d, 'xlf.cfg'))]
54
+ if l:
55
+ from distutils.version import LooseVersion
56
+ self.version = version = LooseVersion(l[0])
57
+ return version
58
+
59
+ def get_flags(self):
60
+ return ['-qextname']
61
+
62
+ def get_flags_debug(self):
63
+ return ['-g']
64
+
65
+ def get_flags_linker_so(self):
66
+ opt = []
67
+ if sys.platform=='darwin':
68
+ opt.append('-Wl,-bundle,-flat_namespace,-undefined,suppress')
69
+ else:
70
+ opt.append('-bshared')
71
+ version = self.get_version(ok_status=[0, 40])
72
+ if version is not None:
73
+ if sys.platform.startswith('aix'):
74
+ xlf_cfg = '/etc/xlf.cfg'
75
+ else:
76
+ xlf_cfg = '/etc/opt/ibmcmp/xlf/%s/xlf.cfg' % version
77
+ fo, new_cfg = make_temp_file(suffix='_xlf.cfg')
78
+ log.info('Creating '+new_cfg)
79
+ with open(xlf_cfg) as fi:
80
+ crt1_match = re.compile(r'\s*crt\s*=\s*(?P<path>.*)/crt1.o').match
81
+ for line in fi:
82
+ m = crt1_match(line)
83
+ if m:
84
+ fo.write('crt = %s/bundle1.o\n' % (m.group('path')))
85
+ else:
86
+ fo.write(line)
87
+ fo.close()
88
+ opt.append('-F'+new_cfg)
89
+ return opt
90
+
91
+ def get_flags_opt(self):
92
+ return ['-O3']
93
+
94
+ if __name__ == '__main__':
95
+ from numpy.distutils import customized_fcompiler
96
+ log.set_verbosity(2)
97
+ print(customized_fcompiler(compiler='ibm').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/intel.py ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # http://developer.intel.com/software/products/compilers/flin/
2
+ import sys
3
+
4
+ from numpy.distutils.ccompiler import simple_version_match
5
+ from numpy.distutils.fcompiler import FCompiler, dummy_fortran_file
6
+
7
+ compilers = ['IntelFCompiler', 'IntelVisualFCompiler',
8
+ 'IntelItaniumFCompiler', 'IntelItaniumVisualFCompiler',
9
+ 'IntelEM64VisualFCompiler', 'IntelEM64TFCompiler']
10
+
11
+
12
+ def intel_version_match(type):
13
+ # Match against the important stuff in the version string
14
+ return simple_version_match(start=r'Intel.*?Fortran.*?(?:%s).*?Version' % (type,))
15
+
16
+
17
+ class BaseIntelFCompiler(FCompiler):
18
+ def update_executables(self):
19
+ f = dummy_fortran_file()
20
+ self.executables['version_cmd'] = ['<F77>', '-FI', '-V', '-c',
21
+ f + '.f', '-o', f + '.o']
22
+
23
+ def runtime_library_dir_option(self, dir):
24
+ # TODO: could use -Xlinker here, if it's supported
25
+ assert "," not in dir
26
+
27
+ return '-Wl,-rpath=%s' % dir
28
+
29
+
30
+ class IntelFCompiler(BaseIntelFCompiler):
31
+
32
+ compiler_type = 'intel'
33
+ compiler_aliases = ('ifort',)
34
+ description = 'Intel Fortran Compiler for 32-bit apps'
35
+ version_match = intel_version_match('32-bit|IA-32')
36
+
37
+ possible_executables = ['ifort', 'ifc']
38
+
39
+ executables = {
40
+ 'version_cmd' : None, # set by update_executables
41
+ 'compiler_f77' : [None, "-72", "-w90", "-w95"],
42
+ 'compiler_f90' : [None],
43
+ 'compiler_fix' : [None, "-FI"],
44
+ 'linker_so' : ["<F90>", "-shared"],
45
+ 'archiver' : ["ar", "-cr"],
46
+ 'ranlib' : ["ranlib"]
47
+ }
48
+
49
+ pic_flags = ['-fPIC']
50
+ module_dir_switch = '-module ' # Don't remove ending space!
51
+ module_include_switch = '-I'
52
+
53
+ def get_flags_free(self):
54
+ return ['-FR']
55
+
56
+ def get_flags(self):
57
+ return ['-fPIC']
58
+
59
+ def get_flags_opt(self): # Scipy test failures with -O2
60
+ v = self.get_version()
61
+ mpopt = 'openmp' if v and v < '15' else 'qopenmp'
62
+ return ['-fp-model', 'strict', '-O1',
63
+ '-assume', 'minus0', '-{}'.format(mpopt)]
64
+
65
+ def get_flags_arch(self):
66
+ return []
67
+
68
+ def get_flags_linker_so(self):
69
+ opt = FCompiler.get_flags_linker_so(self)
70
+ v = self.get_version()
71
+ if v and v >= '8.0':
72
+ opt.append('-nofor_main')
73
+ if sys.platform == 'darwin':
74
+ # Here, it's -dynamiclib
75
+ try:
76
+ idx = opt.index('-shared')
77
+ opt.remove('-shared')
78
+ except ValueError:
79
+ idx = 0
80
+ opt[idx:idx] = ['-dynamiclib', '-Wl,-undefined,dynamic_lookup']
81
+ return opt
82
+
83
+
84
+ class IntelItaniumFCompiler(IntelFCompiler):
85
+ compiler_type = 'intele'
86
+ compiler_aliases = ()
87
+ description = 'Intel Fortran Compiler for Itanium apps'
88
+
89
+ version_match = intel_version_match('Itanium|IA-64')
90
+
91
+ possible_executables = ['ifort', 'efort', 'efc']
92
+
93
+ executables = {
94
+ 'version_cmd' : None,
95
+ 'compiler_f77' : [None, "-FI", "-w90", "-w95"],
96
+ 'compiler_fix' : [None, "-FI"],
97
+ 'compiler_f90' : [None],
98
+ 'linker_so' : ['<F90>', "-shared"],
99
+ 'archiver' : ["ar", "-cr"],
100
+ 'ranlib' : ["ranlib"]
101
+ }
102
+
103
+
104
+ class IntelEM64TFCompiler(IntelFCompiler):
105
+ compiler_type = 'intelem'
106
+ compiler_aliases = ()
107
+ description = 'Intel Fortran Compiler for 64-bit apps'
108
+
109
+ version_match = intel_version_match('EM64T-based|Intel\\(R\\) 64|64|IA-64|64-bit')
110
+
111
+ possible_executables = ['ifort', 'efort', 'efc']
112
+
113
+ executables = {
114
+ 'version_cmd' : None,
115
+ 'compiler_f77' : [None, "-FI"],
116
+ 'compiler_fix' : [None, "-FI"],
117
+ 'compiler_f90' : [None],
118
+ 'linker_so' : ['<F90>', "-shared"],
119
+ 'archiver' : ["ar", "-cr"],
120
+ 'ranlib' : ["ranlib"]
121
+ }
122
+
123
+ # Is there no difference in the version string between the above compilers
124
+ # and the Visual compilers?
125
+
126
+
127
+ class IntelVisualFCompiler(BaseIntelFCompiler):
128
+ compiler_type = 'intelv'
129
+ description = 'Intel Visual Fortran Compiler for 32-bit apps'
130
+ version_match = intel_version_match('32-bit|IA-32')
131
+
132
+ def update_executables(self):
133
+ f = dummy_fortran_file()
134
+ self.executables['version_cmd'] = ['<F77>', '/FI', '/c',
135
+ f + '.f', '/o', f + '.o']
136
+
137
+ ar_exe = 'lib.exe'
138
+ possible_executables = ['ifort', 'ifl']
139
+
140
+ executables = {
141
+ 'version_cmd' : None,
142
+ 'compiler_f77' : [None],
143
+ 'compiler_fix' : [None],
144
+ 'compiler_f90' : [None],
145
+ 'linker_so' : [None],
146
+ 'archiver' : [ar_exe, "/verbose", "/OUT:"],
147
+ 'ranlib' : None
148
+ }
149
+
150
+ compile_switch = '/c '
151
+ object_switch = '/Fo' # No space after /Fo!
152
+ library_switch = '/OUT:' # No space after /OUT:!
153
+ module_dir_switch = '/module:' # No space after /module:
154
+ module_include_switch = '/I'
155
+
156
+ def get_flags(self):
157
+ opt = ['/nologo', '/MD', '/nbs', '/names:lowercase',
158
+ '/assume:underscore', '/fpp']
159
+ return opt
160
+
161
+ def get_flags_free(self):
162
+ return []
163
+
164
+ def get_flags_debug(self):
165
+ return ['/4Yb', '/d2']
166
+
167
+ def get_flags_opt(self):
168
+ return ['/O1', '/assume:minus0'] # Scipy test failures with /O2
169
+
170
+ def get_flags_arch(self):
171
+ return ["/arch:IA32", "/QaxSSE3"]
172
+
173
+ def runtime_library_dir_option(self, dir):
174
+ raise NotImplementedError
175
+
176
+
177
+ class IntelItaniumVisualFCompiler(IntelVisualFCompiler):
178
+ compiler_type = 'intelev'
179
+ description = 'Intel Visual Fortran Compiler for Itanium apps'
180
+
181
+ version_match = intel_version_match('Itanium')
182
+
183
+ possible_executables = ['efl'] # XXX this is a wild guess
184
+ ar_exe = IntelVisualFCompiler.ar_exe
185
+
186
+ executables = {
187
+ 'version_cmd' : None,
188
+ 'compiler_f77' : [None, "-FI", "-w90", "-w95"],
189
+ 'compiler_fix' : [None, "-FI", "-4L72", "-w"],
190
+ 'compiler_f90' : [None],
191
+ 'linker_so' : ['<F90>', "-shared"],
192
+ 'archiver' : [ar_exe, "/verbose", "/OUT:"],
193
+ 'ranlib' : None
194
+ }
195
+
196
+
197
+ class IntelEM64VisualFCompiler(IntelVisualFCompiler):
198
+ compiler_type = 'intelvem'
199
+ description = 'Intel Visual Fortran Compiler for 64-bit apps'
200
+
201
+ version_match = simple_version_match(start=r'Intel\(R\).*?64,')
202
+
203
+ def get_flags_arch(self):
204
+ return []
205
+
206
+
207
+ if __name__ == '__main__':
208
+ from distutils import log
209
+ log.set_verbosity(2)
210
+ from numpy.distutils import customized_fcompiler
211
+ print(customized_fcompiler(compiler='intel').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/lahey.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ from numpy.distutils.fcompiler import FCompiler
4
+
5
+ compilers = ['LaheyFCompiler']
6
+
7
+ class LaheyFCompiler(FCompiler):
8
+
9
+ compiler_type = 'lahey'
10
+ description = 'Lahey/Fujitsu Fortran 95 Compiler'
11
+ version_pattern = r'Lahey/Fujitsu Fortran 95 Compiler Release (?P<version>[^\s*]*)'
12
+
13
+ executables = {
14
+ 'version_cmd' : ["<F90>", "--version"],
15
+ 'compiler_f77' : ["lf95", "--fix"],
16
+ 'compiler_fix' : ["lf95", "--fix"],
17
+ 'compiler_f90' : ["lf95"],
18
+ 'linker_so' : ["lf95", "-shared"],
19
+ 'archiver' : ["ar", "-cr"],
20
+ 'ranlib' : ["ranlib"]
21
+ }
22
+
23
+ module_dir_switch = None #XXX Fix me
24
+ module_include_switch = None #XXX Fix me
25
+
26
+ def get_flags_opt(self):
27
+ return ['-O']
28
+ def get_flags_debug(self):
29
+ return ['-g', '--chk', '--chkglobal']
30
+ def get_library_dirs(self):
31
+ opt = []
32
+ d = os.environ.get('LAHEY')
33
+ if d:
34
+ opt.append(os.path.join(d, 'lib'))
35
+ return opt
36
+ def get_libraries(self):
37
+ opt = []
38
+ opt.extend(['fj9f6', 'fj9i6', 'fj9ipp', 'fj9e6'])
39
+ return opt
40
+
41
+ if __name__ == '__main__':
42
+ from distutils import log
43
+ log.set_verbosity(2)
44
+ from numpy.distutils import customized_fcompiler
45
+ print(customized_fcompiler(compiler='lahey').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/mips.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy.distutils.cpuinfo import cpu
2
+ from numpy.distutils.fcompiler import FCompiler
3
+
4
+ compilers = ['MIPSFCompiler']
5
+
6
+ class MIPSFCompiler(FCompiler):
7
+
8
+ compiler_type = 'mips'
9
+ description = 'MIPSpro Fortran Compiler'
10
+ version_pattern = r'MIPSpro Compilers: Version (?P<version>[^\s*,]*)'
11
+
12
+ executables = {
13
+ 'version_cmd' : ["<F90>", "-version"],
14
+ 'compiler_f77' : ["f77", "-f77"],
15
+ 'compiler_fix' : ["f90", "-fixedform"],
16
+ 'compiler_f90' : ["f90"],
17
+ 'linker_so' : ["f90", "-shared"],
18
+ 'archiver' : ["ar", "-cr"],
19
+ 'ranlib' : None
20
+ }
21
+ module_dir_switch = None #XXX: fix me
22
+ module_include_switch = None #XXX: fix me
23
+ pic_flags = ['-KPIC']
24
+
25
+ def get_flags(self):
26
+ return self.pic_flags + ['-n32']
27
+ def get_flags_opt(self):
28
+ return ['-O3']
29
+ def get_flags_arch(self):
30
+ opt = []
31
+ for a in '19 20 21 22_4k 22_5k 24 25 26 27 28 30 32_5k 32_10k'.split():
32
+ if getattr(cpu, 'is_IP%s'%a)():
33
+ opt.append('-TARG:platform=IP%s' % a)
34
+ break
35
+ return opt
36
+ def get_flags_arch_f77(self):
37
+ r = None
38
+ if cpu.is_r10000(): r = 10000
39
+ elif cpu.is_r12000(): r = 12000
40
+ elif cpu.is_r8000(): r = 8000
41
+ elif cpu.is_r5000(): r = 5000
42
+ elif cpu.is_r4000(): r = 4000
43
+ if r is not None:
44
+ return ['r%s' % (r)]
45
+ return []
46
+ def get_flags_arch_f90(self):
47
+ r = self.get_flags_arch_f77()
48
+ if r:
49
+ r[0] = '-' + r[0]
50
+ return r
51
+
52
+ if __name__ == '__main__':
53
+ from numpy.distutils import customized_fcompiler
54
+ print(customized_fcompiler(compiler='mips').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/nag.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import re
3
+ from numpy.distutils.fcompiler import FCompiler
4
+
5
+ compilers = ['NAGFCompiler', 'NAGFORCompiler']
6
+
7
+ class BaseNAGFCompiler(FCompiler):
8
+ version_pattern = r'NAG.* Release (?P<version>[^(\s]*)'
9
+
10
+ def version_match(self, version_string):
11
+ m = re.search(self.version_pattern, version_string)
12
+ if m:
13
+ return m.group('version')
14
+ else:
15
+ return None
16
+
17
+ def get_flags_linker_so(self):
18
+ return ["-Wl,-shared"]
19
+ def get_flags_opt(self):
20
+ return ['-O4']
21
+ def get_flags_arch(self):
22
+ return []
23
+
24
+ class NAGFCompiler(BaseNAGFCompiler):
25
+
26
+ compiler_type = 'nag'
27
+ description = 'NAGWare Fortran 95 Compiler'
28
+
29
+ executables = {
30
+ 'version_cmd' : ["<F90>", "-V"],
31
+ 'compiler_f77' : ["f95", "-fixed"],
32
+ 'compiler_fix' : ["f95", "-fixed"],
33
+ 'compiler_f90' : ["f95"],
34
+ 'linker_so' : ["<F90>"],
35
+ 'archiver' : ["ar", "-cr"],
36
+ 'ranlib' : ["ranlib"]
37
+ }
38
+
39
+ def get_flags_linker_so(self):
40
+ if sys.platform == 'darwin':
41
+ return ['-unsharedf95', '-Wl,-bundle,-flat_namespace,-undefined,suppress']
42
+ return BaseNAGFCompiler.get_flags_linker_so(self)
43
+ def get_flags_arch(self):
44
+ version = self.get_version()
45
+ if version and version < '5.1':
46
+ return ['-target=native']
47
+ else:
48
+ return BaseNAGFCompiler.get_flags_arch(self)
49
+ def get_flags_debug(self):
50
+ return ['-g', '-gline', '-g90', '-nan', '-C']
51
+
52
+ class NAGFORCompiler(BaseNAGFCompiler):
53
+
54
+ compiler_type = 'nagfor'
55
+ description = 'NAG Fortran Compiler'
56
+
57
+ executables = {
58
+ 'version_cmd' : ["nagfor", "-V"],
59
+ 'compiler_f77' : ["nagfor", "-fixed"],
60
+ 'compiler_fix' : ["nagfor", "-fixed"],
61
+ 'compiler_f90' : ["nagfor"],
62
+ 'linker_so' : ["nagfor"],
63
+ 'archiver' : ["ar", "-cr"],
64
+ 'ranlib' : ["ranlib"]
65
+ }
66
+
67
+ def get_flags_linker_so(self):
68
+ if sys.platform == 'darwin':
69
+ return ['-unsharedrts',
70
+ '-Wl,-bundle,-flat_namespace,-undefined,suppress']
71
+ return BaseNAGFCompiler.get_flags_linker_so(self)
72
+ def get_flags_debug(self):
73
+ version = self.get_version()
74
+ if version and version > '6.1':
75
+ return ['-g', '-u', '-nan', '-C=all', '-thread_safe',
76
+ '-kind=unique', '-Warn=allocation', '-Warn=subnormal']
77
+ else:
78
+ return ['-g', '-nan', '-C=all', '-u', '-thread_safe']
79
+
80
+
81
+ if __name__ == '__main__':
82
+ from distutils import log
83
+ log.set_verbosity(2)
84
+ from numpy.distutils import customized_fcompiler
85
+ compiler = customized_fcompiler(compiler='nagfor')
86
+ print(compiler.get_version())
87
+ print(compiler.get_flags_debug())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/none.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy.distutils.fcompiler import FCompiler
2
+ from numpy.distutils import customized_fcompiler
3
+
4
+ compilers = ['NoneFCompiler']
5
+
6
+ class NoneFCompiler(FCompiler):
7
+
8
+ compiler_type = 'none'
9
+ description = 'Fake Fortran compiler'
10
+
11
+ executables = {'compiler_f77': None,
12
+ 'compiler_f90': None,
13
+ 'compiler_fix': None,
14
+ 'linker_so': None,
15
+ 'linker_exe': None,
16
+ 'archiver': None,
17
+ 'ranlib': None,
18
+ 'version_cmd': None,
19
+ }
20
+
21
+ def find_executables(self):
22
+ pass
23
+
24
+
25
+ if __name__ == '__main__':
26
+ from distutils import log
27
+ log.set_verbosity(2)
28
+ print(customized_fcompiler(compiler='none').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/nv.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy.distutils.fcompiler import FCompiler
2
+
3
+ compilers = ['NVHPCFCompiler']
4
+
5
+ class NVHPCFCompiler(FCompiler):
6
+ """ NVIDIA High Performance Computing (HPC) SDK Fortran Compiler
7
+
8
+ https://developer.nvidia.com/hpc-sdk
9
+
10
+ Since august 2020 the NVIDIA HPC SDK includes the compilers formerly known as The Portland Group compilers,
11
+ https://www.pgroup.com/index.htm.
12
+ See also `numpy.distutils.fcompiler.pg`.
13
+ """
14
+
15
+ compiler_type = 'nv'
16
+ description = 'NVIDIA HPC SDK'
17
+ version_pattern = r'\s*(nvfortran|(pg(f77|f90|fortran)) \(aka nvfortran\)) (?P<version>[\d.-]+).*'
18
+
19
+ executables = {
20
+ 'version_cmd': ["<F90>", "-V"],
21
+ 'compiler_f77': ["nvfortran"],
22
+ 'compiler_fix': ["nvfortran", "-Mfixed"],
23
+ 'compiler_f90': ["nvfortran"],
24
+ 'linker_so': ["<F90>"],
25
+ 'archiver': ["ar", "-cr"],
26
+ 'ranlib': ["ranlib"]
27
+ }
28
+ pic_flags = ['-fpic']
29
+
30
+ module_dir_switch = '-module '
31
+ module_include_switch = '-I'
32
+
33
+ def get_flags(self):
34
+ opt = ['-Minform=inform', '-Mnosecond_underscore']
35
+ return self.pic_flags + opt
36
+
37
+ def get_flags_opt(self):
38
+ return ['-fast']
39
+
40
+ def get_flags_debug(self):
41
+ return ['-g']
42
+
43
+ def get_flags_linker_so(self):
44
+ return ["-shared", '-fpic']
45
+
46
+ def runtime_library_dir_option(self, dir):
47
+ return '-R%s' % dir
48
+
49
+ if __name__ == '__main__':
50
+ from distutils import log
51
+ log.set_verbosity(2)
52
+ from numpy.distutils import customized_fcompiler
53
+ print(customized_fcompiler(compiler='nv').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/pathf95.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy.distutils.fcompiler import FCompiler
2
+
3
+ compilers = ['PathScaleFCompiler']
4
+
5
+ class PathScaleFCompiler(FCompiler):
6
+
7
+ compiler_type = 'pathf95'
8
+ description = 'PathScale Fortran Compiler'
9
+ version_pattern = r'PathScale\(TM\) Compiler Suite: Version (?P<version>[\d.]+)'
10
+
11
+ executables = {
12
+ 'version_cmd' : ["pathf95", "-version"],
13
+ 'compiler_f77' : ["pathf95", "-fixedform"],
14
+ 'compiler_fix' : ["pathf95", "-fixedform"],
15
+ 'compiler_f90' : ["pathf95"],
16
+ 'linker_so' : ["pathf95", "-shared"],
17
+ 'archiver' : ["ar", "-cr"],
18
+ 'ranlib' : ["ranlib"]
19
+ }
20
+ pic_flags = ['-fPIC']
21
+ module_dir_switch = '-module ' # Don't remove ending space!
22
+ module_include_switch = '-I'
23
+
24
+ def get_flags_opt(self):
25
+ return ['-O3']
26
+ def get_flags_debug(self):
27
+ return ['-g']
28
+
29
+ if __name__ == '__main__':
30
+ from distutils import log
31
+ log.set_verbosity(2)
32
+ from numpy.distutils import customized_fcompiler
33
+ print(customized_fcompiler(compiler='pathf95').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/pg.py ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # http://www.pgroup.com
2
+ import sys
3
+
4
+ from numpy.distutils.fcompiler import FCompiler
5
+ from sys import platform
6
+ from os.path import join, dirname, normpath
7
+
8
+ compilers = ['PGroupFCompiler', 'PGroupFlangCompiler']
9
+
10
+
11
+ class PGroupFCompiler(FCompiler):
12
+
13
+ compiler_type = 'pg'
14
+ description = 'Portland Group Fortran Compiler'
15
+ version_pattern = r'\s*pg(f77|f90|hpf|fortran) (?P<version>[\d.-]+).*'
16
+
17
+ if platform == 'darwin':
18
+ executables = {
19
+ 'version_cmd': ["<F77>", "-V"],
20
+ 'compiler_f77': ["pgfortran", "-dynamiclib"],
21
+ 'compiler_fix': ["pgfortran", "-Mfixed", "-dynamiclib"],
22
+ 'compiler_f90': ["pgfortran", "-dynamiclib"],
23
+ 'linker_so': ["libtool"],
24
+ 'archiver': ["ar", "-cr"],
25
+ 'ranlib': ["ranlib"]
26
+ }
27
+ pic_flags = ['']
28
+ else:
29
+ executables = {
30
+ 'version_cmd': ["<F77>", "-V"],
31
+ 'compiler_f77': ["pgfortran"],
32
+ 'compiler_fix': ["pgfortran", "-Mfixed"],
33
+ 'compiler_f90': ["pgfortran"],
34
+ 'linker_so': ["<F90>"],
35
+ 'archiver': ["ar", "-cr"],
36
+ 'ranlib': ["ranlib"]
37
+ }
38
+ pic_flags = ['-fpic']
39
+
40
+ module_dir_switch = '-module '
41
+ module_include_switch = '-I'
42
+
43
+ def get_flags(self):
44
+ opt = ['-Minform=inform', '-Mnosecond_underscore']
45
+ return self.pic_flags + opt
46
+
47
+ def get_flags_opt(self):
48
+ return ['-fast']
49
+
50
+ def get_flags_debug(self):
51
+ return ['-g']
52
+
53
+ if platform == 'darwin':
54
+ def get_flags_linker_so(self):
55
+ return ["-dynamic", '-undefined', 'dynamic_lookup']
56
+
57
+ else:
58
+ def get_flags_linker_so(self):
59
+ return ["-shared", '-fpic']
60
+
61
+ def runtime_library_dir_option(self, dir):
62
+ return '-R%s' % dir
63
+
64
+
65
+ import functools
66
+
67
+ class PGroupFlangCompiler(FCompiler):
68
+ compiler_type = 'flang'
69
+ description = 'Portland Group Fortran LLVM Compiler'
70
+ version_pattern = r'\s*(flang|clang) version (?P<version>[\d.-]+).*'
71
+
72
+ ar_exe = 'lib.exe'
73
+ possible_executables = ['flang']
74
+
75
+ executables = {
76
+ 'version_cmd': ["<F77>", "--version"],
77
+ 'compiler_f77': ["flang"],
78
+ 'compiler_fix': ["flang"],
79
+ 'compiler_f90': ["flang"],
80
+ 'linker_so': [None],
81
+ 'archiver': [ar_exe, "/verbose", "/OUT:"],
82
+ 'ranlib': None
83
+ }
84
+
85
+ library_switch = '/OUT:' # No space after /OUT:!
86
+ module_dir_switch = '-module ' # Don't remove ending space!
87
+
88
+ def get_libraries(self):
89
+ opt = FCompiler.get_libraries(self)
90
+ opt.extend(['flang', 'flangrti', 'ompstub'])
91
+ return opt
92
+
93
+ @functools.lru_cache(maxsize=128)
94
+ def get_library_dirs(self):
95
+ """List of compiler library directories."""
96
+ opt = FCompiler.get_library_dirs(self)
97
+ flang_dir = dirname(self.executables['compiler_f77'][0])
98
+ opt.append(normpath(join(flang_dir, '..', 'lib')))
99
+
100
+ return opt
101
+
102
+ def get_flags(self):
103
+ return []
104
+
105
+ def get_flags_free(self):
106
+ return []
107
+
108
+ def get_flags_debug(self):
109
+ return ['-g']
110
+
111
+ def get_flags_opt(self):
112
+ return ['-O3']
113
+
114
+ def get_flags_arch(self):
115
+ return []
116
+
117
+ def runtime_library_dir_option(self, dir):
118
+ raise NotImplementedError
119
+
120
+
121
+ if __name__ == '__main__':
122
+ from distutils import log
123
+ log.set_verbosity(2)
124
+ from numpy.distutils import customized_fcompiler
125
+ if 'flang' in sys.argv:
126
+ print(customized_fcompiler(compiler='flang').get_version())
127
+ else:
128
+ print(customized_fcompiler(compiler='pg').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/sun.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy.distutils.ccompiler import simple_version_match
2
+ from numpy.distutils.fcompiler import FCompiler
3
+
4
+ compilers = ['SunFCompiler']
5
+
6
+ class SunFCompiler(FCompiler):
7
+
8
+ compiler_type = 'sun'
9
+ description = 'Sun or Forte Fortran 95 Compiler'
10
+ # ex:
11
+ # f90: Sun WorkShop 6 update 2 Fortran 95 6.2 Patch 111690-10 2003/08/28
12
+ version_match = simple_version_match(
13
+ start=r'f9[05]: (Sun|Forte|WorkShop).*Fortran 95')
14
+
15
+ executables = {
16
+ 'version_cmd' : ["<F90>", "-V"],
17
+ 'compiler_f77' : ["f90"],
18
+ 'compiler_fix' : ["f90", "-fixed"],
19
+ 'compiler_f90' : ["f90"],
20
+ 'linker_so' : ["<F90>", "-Bdynamic", "-G"],
21
+ 'archiver' : ["ar", "-cr"],
22
+ 'ranlib' : ["ranlib"]
23
+ }
24
+ module_dir_switch = '-moddir='
25
+ module_include_switch = '-M'
26
+ pic_flags = ['-xcode=pic32']
27
+
28
+ def get_flags_f77(self):
29
+ ret = ["-ftrap=%none"]
30
+ if (self.get_version() or '') >= '7':
31
+ ret.append("-f77")
32
+ else:
33
+ ret.append("-fixed")
34
+ return ret
35
+ def get_opt(self):
36
+ return ['-fast', '-dalign']
37
+ def get_arch(self):
38
+ return ['-xtarget=generic']
39
+ def get_libraries(self):
40
+ opt = []
41
+ opt.extend(['fsu', 'sunmath', 'mvec'])
42
+ return opt
43
+
44
+ def runtime_library_dir_option(self, dir):
45
+ return '-R%s' % dir
46
+
47
+ if __name__ == '__main__':
48
+ from distutils import log
49
+ log.set_verbosity(2)
50
+ from numpy.distutils import customized_fcompiler
51
+ print(customized_fcompiler(compiler='sun').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/fcompiler/vast.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ from numpy.distutils.fcompiler.gnu import GnuFCompiler
4
+
5
+ compilers = ['VastFCompiler']
6
+
7
+ class VastFCompiler(GnuFCompiler):
8
+ compiler_type = 'vast'
9
+ compiler_aliases = ()
10
+ description = 'Pacific-Sierra Research Fortran 90 Compiler'
11
+ version_pattern = (r'\s*Pacific-Sierra Research vf90 '
12
+ r'(Personal|Professional)\s+(?P<version>[^\s]*)')
13
+
14
+ # VAST f90 does not support -o with -c. So, object files are created
15
+ # to the current directory and then moved to build directory
16
+ object_switch = ' && function _mvfile { mv -v `basename $1` $1 ; } && _mvfile '
17
+
18
+ executables = {
19
+ 'version_cmd' : ["vf90", "-v"],
20
+ 'compiler_f77' : ["g77"],
21
+ 'compiler_fix' : ["f90", "-Wv,-ya"],
22
+ 'compiler_f90' : ["f90"],
23
+ 'linker_so' : ["<F90>"],
24
+ 'archiver' : ["ar", "-cr"],
25
+ 'ranlib' : ["ranlib"]
26
+ }
27
+ module_dir_switch = None #XXX Fix me
28
+ module_include_switch = None #XXX Fix me
29
+
30
+ def find_executables(self):
31
+ pass
32
+
33
+ def get_version_cmd(self):
34
+ f90 = self.compiler_f90[0]
35
+ d, b = os.path.split(f90)
36
+ vf90 = os.path.join(d, 'v'+b)
37
+ return vf90
38
+
39
+ def get_flags_arch(self):
40
+ vast_version = self.get_version()
41
+ gnu = GnuFCompiler()
42
+ gnu.customize(None)
43
+ self.version = gnu.get_version()
44
+ opt = GnuFCompiler.get_flags_arch(self)
45
+ self.version = vast_version
46
+ return opt
47
+
48
+ if __name__ == '__main__':
49
+ from distutils import log
50
+ log.set_verbosity(2)
51
+ from numpy.distutils import customized_fcompiler
52
+ print(customized_fcompiler(compiler='vast').get_version())
.venv/lib/python3.11/site-packages/numpy/distutils/mingw/gfortran_vs2003_hack.c ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ int _get_output_format(void)
2
+ {
3
+ return 0;
4
+ }
5
+
6
+ int _imp____lc_codepage = 0;
.venv/lib/python3.11/site-packages/numpy/distutils/tests/__init__.py ADDED
File without changes
.venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (194 Bytes). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_build_ext.cpython-311.pyc ADDED
Binary file (4.51 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt.cpython-311.pyc ADDED
Binary file (33.2 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt_conf.cpython-311.pyc ADDED
Binary file (9.87 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_exec_command.cpython-311.pyc ADDED
Binary file (15.4 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler.cpython-311.pyc ADDED
Binary file (2.19 kB). View file