From 6c55b513bfbb9d04d0339715637c356cd4858663 Mon Sep 17 00:00:00 2001 From: "borenet@google.com" Date: Thu, 24 Jan 2013 21:38:51 +0000 Subject: [PATCH] Modify submit_try to work on windows Review URL: https://codereview.appspot.com/7199053 git-svn-id: http://skia.googlecode.com/svn/trunk@7379 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tools/submit_try | 23 +++++++++++++++-------- tools/submit_try.bat | 1 + 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 tools/submit_try.bat diff --git a/tools/submit_try b/tools/submit_try index d62c9fb5c..2d18fc653 100755 --- a/tools/submit_try +++ b/tools/submit_try @@ -52,7 +52,7 @@ def FindDepotTools(): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if proc.wait() != 0: raise Exception('Couldn\'t find depot_tools in PATH!') - gcl = proc.communicate()[0] + gcl = proc.communicate()[0].split('\n')[0].rstrip() depot_tools_dir = os.path.dirname(gcl) return depot_tools_dir @@ -64,7 +64,8 @@ def GetCheckoutRoot(is_svn=True): a git checkout. """ if is_svn: - cmd = ['svn', 'info'] + svn_cmd = 'svn.bat' if os.name == 'nt' else 'svn' + cmd = [svn_cmd, 'info'] proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if proc.wait() != 0: @@ -165,18 +166,24 @@ def SubmitTryRequest(args, is_svn=True): - revision: optional, int; the revision number from which to run the try. is_svn: boolean; are we in an SVN repo? """ - # First, find depot_tools. This is needed for the imports below. - sys.path.append(FindDepotTools()) - botlist = ','.join(['%s%s' % (bot, TRYBOT_SUFFIX) for bot in args.bot]) if is_svn: - import gcl - try_args = [args.changelist, '--root', GetCheckoutRoot(is_svn), + gcl_cmd = 'gcl.bat' if os.name == 'nt' else 'gcl' + try_args = [gcl_cmd, 'try', args.changelist, + '--root', GetCheckoutRoot(is_svn), '--bot', botlist] if args.revision: try_args.extend(['-r', args.revision]) - gcl.CMDtry(try_args) + print ' '.join(try_args) + proc = subprocess.Popen(try_args, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + if proc.wait() != 0: + raise Exception('Failed to submit try request: %s' % ( + proc.communicate()[0])) + print proc.communicate()[0] else: + # First, find depot_tools. This is needed to import trychange. + sys.path.append(FindDepotTools()) import trychange try_args = ['--use_svn', '--svn_repo', GetTryRepo(), diff --git a/tools/submit_try.bat b/tools/submit_try.bat new file mode 100644 index 000000000..d1d539286 --- /dev/null +++ b/tools/submit_try.bat @@ -0,0 +1 @@ +python tools\submit_try %* \ No newline at end of file