Go through the self.executables dictionary, and attempt to find and assign appropriate executables. Executable names are looked for in the environment (environment variables, the distutils.cfg, and command line), the 0th-element of the command list, and the self.poss
(self)
| 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 |
no test coverage detected