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