Skip to content

Commit

Permalink
Merge pull request numpy#212 from mwiebe/cache-fortran-detect
Browse files Browse the repository at this point in the history
BLD: Avoid repeatedly testing for the Fortran compiler when it is missing
  • Loading branch information
mwiebe committed Feb 20, 2012
2 parents 16d49fd + ad2ce59 commit d5962f4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions numpy/distutils/fcompiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,9 @@ def get_default_fcompiler(osname=None, platform=None, requiref90=False,
c_compiler=c_compiler)
return compiler_type

# Flag to avoid rechecking for Fortran compiler every time
failed_fcompiler = False

def new_fcompiler(plat=None,
compiler=None,
verbose=0,
Expand All @@ -824,6 +827,10 @@ def new_fcompiler(plat=None,
"""Generate an instance of some FCompiler subclass for the supplied
platform/compiler combination.
"""
global failed_fcompiler
if failed_fcompiler:
return None

load_all_fcompiler_classes()
if plat is None:
plat = os.name
Expand All @@ -841,6 +848,7 @@ def new_fcompiler(plat=None,
msg = msg + " Supported compilers are: %s)" \
% (','.join(fcompiler_class.keys()))
log.warn(msg)
failed_fcompiler = True
return None

compiler = klass(verbose=verbose, dry_run=dry_run, force=force)
Expand Down

0 comments on commit d5962f4

Please sign in to comment.