Changeset 4812


Ignore:
Timestamp:
Nov 12, 2007, 5:03:44 PM (17 years ago)
Author:
ole
Message:

Added diagnostics about missing compiler and comments to the compile script.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/compile.py

    r4811 r4812  
    1010   Ole Nielsen, Duncan Gray Oct 2001     
    1111"""     
     12
     13# FIXME (Ole): Although this script says it works with a range of compilers,
     14# it has only really been used with gcc.
    1215
    1316import os, string, sys, types
     
    151154
    152155  # Verify that compiler can be executed
    153   s = '%s --version' %compiler
    154   s = s + ' > /dev/null' # Suppress output
     156  print 'Compiler: %s, version ' %compiler,
     157  s = '%s -dumpversion' %(compiler)
    155158  err = os.system(s)
     159  print
    156160  if err != 0:
    157       msg = 'Unable to execute compiler: %s.' %compiler
    158       msg += 'Make sure it is available on the system path.'
    159       msg += 'One way is to try to check that %s runs on ' %compiler
     161      msg = 'Unable to execute compiler: %s. ' %compiler
     162      msg += 'Make sure it is available on the system path.\n'
     163      msg += 'One way to check this is to run %s on ' %compiler
    160164      msg += 'the commandline.'
    161       raise Exception, msg
    162      
    163        
     165      raise Exception, msg   
     166
     167 
    164168  # Find location of include files
    165169  #
     
    183187
    184188
    185   #Add Python path + utilities to includelist (see ticket:31)
    186   #Assume there is only one 'utilities' dir under path dirs
     189  # Add Python path + utilities to includelist (see ticket:31)
     190  # Assume there is only one 'utilities' dir under path dirs
    187191 
    188192  utilities_include_dir = None
     
    263267    if verbose:
    264268      print s
    265     else:
    266       s = s + ' 2> /dev/null' #Suppress errors
    267  
     269
     270    # Doesn't work on Windows anyway 
     271    #else:
     272    #  s = s + ' 2> /dev/null' #Suppress errors
     273   
    268274    try:
    269275      err = os.system(s)
     
    279285  else:
    280286    s = '%s -%s %s -o %s.%s "%s" -lm' %(loader, sharedflag, object_files, root1, libext, libs)
     287   
    281288  if verbose:
    282289    print s
    283   else:
    284     s = s + ' 2> /dev/null' #Suppress warnings
     290
     291  # Doesn't work on Windows anyway     
     292  #else:
     293  #  s = s + ' 2> /dev/null' #Suppress warnings
    285294 
    286295  try: 
    287296    err=os.system(s)
    288297    if err != 0:       
    289         raise 'Atempting to link %s failed - please try manually' %root1     
     298        raise 'Attempting to link %s failed - please try manually' %root1     
    290299  except:
    291300    raise 'Could not link %s - please try manually' %root1
     
    414423              compile(filename)
    415424          except Exception, e:
    416               print 'Could not compile C extension %s' %filename
     425              msg = 'Could not compile C extension %s\n' %filename
     426              msg += str(e)
     427              raise Exception, msg
    417428          else:
    418429              print 'C extension %s OK' %filename
Note: See TracChangeset for help on using the changeset viewer.