def gen_preprocess_options(macros, include_dirs):
 pp_opts = []
 for macro in macros:
  if (not ((type(macro) is TupleType) and (1 <= len(macro) <= 2))):
   raise TypeError, (("bad macro definition '%s': " + "each element of 'macros' list must be a 1- or 2-tuple") % macro)
  if (len(macro) == 1):
   pp_opts.append(('-U%s' % macro[0]))
  elif (len(macro) == 2):
   if (macro[1] is None):
    pp_opts.append(('-D%s' % macro[0]))
   else:
    pp_opts.append(('-D%s=%s' % macro))
 for dir in include_dirs:
  pp_opts.append(('-I%s' % dir))
 return pp_opts

def gen_preprocess_options ( macros , include_dirs ) : pp_opts = [ ] for macro in macros : if ( not ( ( type ( macro ) is TupleType ) and ( 1 <= len ( macro ) <= 2 ) ) ) : raise TypeError , ( ( "bad macro definition '%s': " + "each element of 'macros' list must be a 1- or 2-tuple" ) % macro ) if ( len ( macro ) == 1 ) : pp_opts . append ( ( '-U%s' % macro [ 0 ] ) ) elif ( len ( macro ) == 2 ) : if ( macro [ 1 ] is None ) : pp_opts . append ( ( '-D%s' % macro [ 0 ] ) ) else : pp_opts . append ( ( '-D%s=%s' % macro ) ) for dir in include_dirs : pp_opts . append ( ( '-I%s' % dir ) ) return pp_opts
generate c pre-processor options as used by at least two types of compilers: the typical unix compiler and visual c++ .