1#!/usr/bin/python 2 3import os 4import sys 5 6flags_to_append = [] 7flags_to_insert = [] 8 9myargs = sys.argv[1:] 10 11myargs = flags_to_insert + myargs + flags_to_append 12 13real_compiler = sys.argv[0] + '.real' 14argv0 = real_compiler 15 16def get_gomacc_command(): 17 """Return the gomacc command if it is found in $GOMACC_PATH.""" 18 gomacc = os.environ.get('GOMACC_PATH') 19 if gomacc and os.path.isfile(gomacc): 20 return gomacc 21 return None 22 23execargs = [] 24gomacc = get_gomacc_command() 25if gomacc: 26 argv0 = gomacc 27 execargs += [gomacc] 28 29execargs += [real_compiler] + myargs 30 31os.execv(argv0, execargs) 32