Changeset 2713

Show
Ignore:
Timestamp:
11/06/17 01:44:39 (3 years ago)
Author:
jwoithe
Message:

SConstruct: use "in" operator rather than has_key().

The former works in python2 (scons2) and python3 (scons3). Patch from Orcan
Ogetbil.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/SConstruct

    r2711 r2713  
    9393custom_flags = False 
    9494 
    95 if env.has_key('COMPILE_FLAGS') and len(env['COMPILE_FLAGS']) > 0: 
     95if 'COMPILE_FLAGS' in env and len(env['COMPILE_FLAGS']) > 0: 
    9696    print("The COMPILE_FLAGS option is deprecated. Use CFLAGS and CXXFLAGS with CUSTOM_ENV=True instead") 
    9797    custom_flags = True 
     
    102102 
    103103    # Honour the user choice of compiler (if any). 
    104     if os.environ.has_key('CC') and len(os.environ['CC']) > 0: 
     104    if 'CC' in os.environ and len(os.environ['CC']) > 0: 
    105105        env['CC'] = os.environ['CC'] 
    106     if os.environ.has_key('CXX') and len(os.environ['CXX']) > 0: 
     106    if 'CXX' in os.environ and len(os.environ['CXX']) > 0: 
    107107        env['CXX'] = os.environ['CXX'] 
    108108 
    109109    # Honour the user supplied flags (if any), but notify the user that this is not supported. 
    110     if os.environ.has_key('CFLAGS') and len(os.environ['CFLAGS']) > 0: 
     110    if 'CFLAGS' in os.environ and len(os.environ['CFLAGS']) > 0: 
    111111        env.Append(CFLAGS = str(os.environ['CFLAGS'].replace('\"', ''))) 
    112     if os.environ.has_key('CXXFLAGS') and len(os.environ['CXXFLAGS']) > 0: 
     112    if 'CXXFLAGS' in os.environ and len(os.environ['CXXFLAGS']) > 0: 
    113113        env.Append(CXXFLAGS = str(os.environ['CXXFLAGS'].replace('\"', ''))) 
    114     if os.environ.has_key('LDFLAGS') and len(os.environ['LDFLAGS']) > 0: 
     114    if 'LDFLAGS' in os.environ and len(os.environ['LDFLAGS']) > 0: 
    115115        env.Append(LINKFLAGS = str(os.environ['LDFLAGS'].replace('\"', ''))) 
    116116 
     
    373373    # way which seems to work properly.  CheckFunc() fails due to 
    374374    # argument count problems. 
    375     if env.has_key( 'CFLAGS' )
     375    if 'CFLAGS' in env
    376376        oldcf = env['CFLAGS'] 
    377377    else: 
     
    837837 
    838838 
    839 if needs_fPIC or ( env.has_key('COMPILE_FLAGS') and '-fPIC' in env['COMPILE_FLAGS'] ): 
     839if needs_fPIC or ( 'COMPILE_FLAGS' in env and '-fPIC' in env['COMPILE_FLAGS'] ): 
    840840    env.MergeFlags( "-fPIC" ) 
    841841