Skip to content

Instantly share code, notes, and snippets.

@hackcasual
Created January 24, 2017 19:15
Show Gist options
  • Save hackcasual/1623f3b11cad2088fae4eb08fca6c022 to your computer and use it in GitHub Desktop.
Save hackcasual/1623f3b11cad2088fae4eb08fca6c022 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# This script should work in python 2 *or* 3. It loads emar.py, which needs python 2.
from tools.toolchain_profiler import ToolchainProfiler
import sys, re
# Look for RSP files passed in
rsp_regex = re.compile("@(.+rsp)$")
rsp_files = [m.group(1) for l in sys.argv for m in [rsp_regex.search(l)] if m]
# For any RSP files we find, convert \ to /
for rf in rsp_files:
il = []
with open(rf) as f:
il = [re.sub(r"\\", "/", l) for l in f.readlines()]
with open(rf, "w") as f:
f.write(''.join(il))
if sys.version_info.major == 2:
import emar
if __name__ == '__main__':
ToolchainProfiler.record_process_start()
emar.run()
sys.exit(0)
else:
import os, subprocess
if __name__ == '__main__':
sys.exit(subprocess.call(['python2', os.path.join(os.path.dirname(__file__), 'emar.py')] + sys.argv[1:]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment