def build_and_run(args):
 cy_args = []
 last_arg = None
 for (i, arg) in enumerate(args):
  if arg.startswith('-'):
   cy_args.append(arg)
  elif (last_arg in ('-X', '--directive')):
   cy_args.append(arg)
  else:
   input_file = arg
   args = args[(i + 1):]
   break
  last_arg = arg
 else:
  raise ValueError('no input file provided')
 program_name = build(input_file, cy_args)
 exec_file(program_name, args)

def build_and_run ( args ) : cy_args = [ ] last_arg = None for ( i , arg ) in enumerate ( args ) : if arg . startswith ( '-' ) : cy_args . append ( arg ) elif ( last_arg in ( '-X' , '--directive' ) ) : cy_args . append ( arg ) else : input_file = arg args = args [ ( i + 1 ) : ] break last_arg = arg else : raise ValueError ( 'no input file provided' ) program_name = build ( input_file , cy_args ) exec_file ( program_name , args )
build an executable program from a cython module and runs it .