Index: pylib/gyp/win_tool.py |
diff --git a/pylib/gyp/win_tool.py b/pylib/gyp/win_tool.py |
index ba2e86bcb57bbd738a14f395ae935b27f53d5511..55cf0f12cc417fc57c7b205e496e00204e6b2ba1 100644 |
--- a/pylib/gyp/win_tool.py |
+++ b/pylib/gyp/win_tool.py |
@@ -9,8 +9,10 @@ |
These functions are executed via gyp-win-tool when using the ninja generator. |
""" |
+import json |
import os |
import shutil |
+import subprocess |
import sys |
@@ -49,6 +51,43 @@ class WinTool(object): |
else: |
shutil.copy2(source, dest) |
+ def ExecTouch(self, path): |
+ """Basic touch.""" |
+ if os.path.exists(path): |
+ os.utime(path, None) |
+ else: |
+ open(path, 'w').close() |
+ |
+ def ExecQuietMidl(self, outdir, tlb, h, dlldata, iid, proxy, idl, *flags): |
+ args = ['midl', '/nologo'] + list(flags) + [ |
+ '/out', outdir, |
+ '/tlb', tlb, |
+ '/h', h, |
+ '/dlldata', dlldata, |
+ '/iid', iid, |
+ '/proxy', proxy, |
+ idl] |
+ popen = subprocess.Popen(args, |
+ shell=True, |
+ stdout=subprocess.PIPE, |
+ stderr=subprocess.STDOUT) |
+ out, err = popen.communicate() |
+ # TODO(scottmg): Filter out the silly noise. |
+ sys.stdout.write(out) |
+ return popen.returncode |
+ |
+ def ExecDealWithCygwin(self, argspath): |
+ """|path| contains the arguments to a cygwin bash sub-shell in python |
+ repr()'d format. Returns error code from sub-shell.""" |
+ build_to_base, cygdirs, args = json.loads(open(argspath, 'r').read()) |
+ # TODO(scottmg): Totally don't get how this setup path is supposed to |
+ # work. msvs_cygwin_dirs? But never seems right. |
+ args = ' '.join(a.replace('\\', '/') for a in args) |
+ cmd = 'call ..\\..\\third_party\\cygwin\\setup_env.bat && ' \ |
+ 'cd %s && ' \ |
+ 'bash -c "%s"' % (build_to_base, args) |
+ print "running:", cmd |
+ return os.system(cmd) |
if __name__ == '__main__': |
sys.exit(main(sys.argv[1:])) |