vast.py 1.7 KB

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