vast.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import os
  2. from numpy.distutils.fcompiler.gnu import GnuFCompiler
  3. compilers = ['VastFCompiler']
  4. class VastFCompiler(GnuFCompiler):
  5. compiler_type = 'vast'
  6. compiler_aliases = ()
  7. description = 'Pacific-Sierra Research Fortran 90 Compiler'
  8. version_pattern = (r'\s*Pacific-Sierra Research vf90 '
  9. r'(Personal|Professional)\s+(?P<version>[^\s]*)')
  10. # VAST f90 does not support -o with -c. So, object files are created
  11. # to the current directory and then moved to build directory
  12. object_switch = ' && function _mvfile { mv -v `basename $1` $1 ; } && _mvfile '
  13. executables = {
  14. 'version_cmd' : ["vf90", "-v"],
  15. 'compiler_f77' : ["g77"],
  16. 'compiler_fix' : ["f90", "-Wv,-ya"],
  17. 'compiler_f90' : ["f90"],
  18. 'linker_so' : ["<F90>"],
  19. 'archiver' : ["ar", "-cr"],
  20. 'ranlib' : ["ranlib"]
  21. }
  22. module_dir_switch = None #XXX Fix me
  23. module_include_switch = None #XXX Fix me
  24. def find_executables(self):
  25. pass
  26. def get_version_cmd(self):
  27. f90 = self.compiler_f90[0]
  28. d, b = os.path.split(f90)
  29. vf90 = os.path.join(d, 'v'+b)
  30. return vf90
  31. def get_flags_arch(self):
  32. vast_version = self.get_version()
  33. gnu = GnuFCompiler()
  34. gnu.customize(None)
  35. self.version = gnu.get_version()
  36. opt = GnuFCompiler.get_flags_arch(self)
  37. self.version = vast_version
  38. return opt
  39. if __name__ == '__main__':
  40. from distutils import log
  41. log.set_verbosity(2)
  42. from numpy.distutils import customized_fcompiler
  43. print(customized_fcompiler(compiler='vast').get_version())