blob: da019e866114b0a3df4d35796ab318e02db81a7d [file] [log] [blame]
#!/usr/bin/env python
import os
import re
import subprocess
import sys
def DoMain(*args):
cc = os.environ.get('CC', 'gcc')
stdin, stderr = os.pipe()
subprocess.call([cc, '-v'], stderr=stderr)
output = os.read(stdin, 4096)
match = re.search("\ngcc version (\d+\.\d+\.\d+)", output)
if match:
print(match.group(1))
if __name__ == '__main__':
DoMain(*sys.argv)