compiler_fortran.py :  » Build » Waf » waf-1.5.17 » playground » fortran » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Build » Waf 
Waf » waf 1.5.17 » playground » fortran » compiler_fortran.py
#!/usr/bin/env python
# encoding: utf-8

import os, sys, imp, types, ccroot
import optparse
import Utils, Configure, Options

fortran_compiler = {
  'darwin': ['gfortran', 'ifort'],
  'linux': ['gfortran', 'ifort'],
  'default': ['gfortran']
}

def __list_possible_compiler(platform):
  try:
    return(fortran_compiler[platform])
  except KeyError:
    return(fortran_compiler["default"])

def detect(conf):
  try: 
    test_for_compiler = Options.options.check_fortran_compiler
  except AttributeError: 
    raise Configure.ConfigurationError(
        "Add set_options(opt): opt.tool_options('compiler_fortran')")
  for compiler in test_for_compiler.split():
    try:
      conf.check_tool(compiler)
    except Configure.ConfigurationError:
      pass
    else:
      if conf.env['FC']:
        conf.check_message("%s" % compiler, '', True)
        conf.env["COMPILER_FC"] = "%s" % compiler
        return
      conf.check_message("%s" %fortran_compiler, '', False)
      break
  conf.env["COMPILER_FC"] = None

def set_options(opt):
  detected_platform = Options.platform
  possible_compiler_list = __list_possible_compiler(detected_platform)
  test_for_compiler = str(" ").join(possible_compiler_list)
  fortran_compiler_opts = opt.add_option_group("Fortran Compiler Options")
  fortran_compiler_opts.add_option('--check-fortran-compiler', 
      default="%s" % test_for_compiler,
      help='On this platform (%s) the following Fortran Compiler will be checked by default: "%s"' % (detected_platform, test_for_compiler),
    dest="check_fortran_compiler")

  for compiler in test_for_compiler.split():
    opt.tool_options('%s' % compiler, option_group=fortran_compiler_opts)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.