Chromium Code Reviews| Index: visual_studio/NativeClientVSAddIn/buildbot_run.py |
| diff --git a/visual_studio/NativeClientVSAddIn/buildbot_run.py b/visual_studio/NativeClientVSAddIn/buildbot_run.py |
| index d6b20201c05be61e5773ef05017af19e6e3fc043..24c69ecf41f37884d91ef0db4fe9950295a02fcc 100644 |
| --- a/visual_studio/NativeClientVSAddIn/buildbot_run.py |
| +++ b/visual_studio/NativeClientVSAddIn/buildbot_run.py |
| @@ -11,6 +11,9 @@ annootator syntax |
| import os |
| import sys |
| import subprocess |
| +import urllib2 |
| +import zipfile |
| +from os.path import join |
|
binji
2012/10/09 01:05:11
any reason for this? calling it "join" makes it se
Sam Clegg
2012/10/09 17:04:33
This is a pattern that I've followed over the year
|
| GSURL = 'https://commondatastorage.googleapis.com' |
| GSPATH = 'nativeclient-mirror/nacl/nacl_sdk/sdk' |
| @@ -23,6 +26,11 @@ def Log(msg): |
| def RunCommand(cmd): |
| Log("Running: %s" % cmd) |
| Log("CWD: %s" % os.getcwd()) |
| + if type(cmd) == str: |
| + if sys.platform == 'cygwin': |
|
binji
2012/10/09 01:05:11
what about when the cmd is a list?
Sam Clegg
2012/10/09 17:04:33
You are right it could be nicer. I'm making the a
|
| + cmd = './' + cmd |
| + cmd = [cmd] |
| + |
| rtn = subprocess.call(cmd, shell=True) |
| if rtn: |
| Log('@@@STEP_FAILURE@@@') |
| @@ -31,21 +39,48 @@ def RunCommand(cmd): |
| def StepBuild(): |
| Log('@@@BUILD_STEP build AddIn@@@') |
| - if sys.platform == 'cygwin': |
| - RunCommand(['./build.bat']) |
| - else: |
| - RunCommand(['build.bat']) |
| + RunCommand('build.bat') |
| + |
| + |
| +def StepInstall(): |
| + Log('@@@BUILD_STEP Install AddIn@@@') |
| + RunCommand('developer_deploy.bat') |
| + |
| + |
| +def StepInstallSDK(): |
| + Log('@@@BUILD_STEP Install SDK@@@') |
| + sdk_root = join('..', '..', 'out', 'sdk') |
|
binji
2012/10/09 01:05:11
make this path a constant.
Sam Clegg
2012/10/09 17:04:33
Done.
|
| + naclsdk = join(sdk_root, 'nacl_sdk', 'naclsdk.bat') |
| + if not os.path.exists(naclsdk): |
| + if not os.path.exists(sdk_root): |
| + os.makedirs(sdk_root) |
| + filename = join(sdk_root, 'nacl_sdk.zip') |
| + url = "http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip" |
|
binji
2012/10/09 01:05:11
Use GSURL above (and add a new path to this file)
Sam Clegg
2012/10/09 17:04:33
Done.
|
| + contents = urllib2.urlopen(url).read() |
| + with open(filename, 'wb') as zfileout: |
| + zfileout.write(contents) |
| + zfile = zipfile.ZipFile(filename) |
| + print zfile |
|
binji
2012/10/09 01:05:11
does this print anything useful?
Sam Clegg
2012/10/09 17:04:33
Done.
|
| + zfile.extractall(sdk_root) |
| + |
| + RunCommand([naclsdk, '--update-sdk-tools']) |
| + RunCommand([naclsdk, 'install', '--force', 'pepper_23']) |
| + RunCommand([naclsdk, 'install', '--force', 'pepper_canary']) |
| def StepTest(): |
| Log('@@@BUILD_STEP Testing AddIn@@@') |
| # Don't actually test yet |
| - #RunCommand(['test.bat']) |
| + sdk_root = os.path.abspath(join('..', '..', 'out', 'sdk', 'nacl_sdk')) |
| + os.environ['NACL_SDK_ROOT'] = join(sdk_root, 'pepper_23') |
|
binji
2012/10/09 01:05:11
Probably nicer to set the environment in RunComman
Sam Clegg
2012/10/09 17:04:33
Done.
|
| + RunCommand('test.bat') |
| + os.environ['NACL_SDK_ROOT'] = join(sdk_root, 'pepper_canary') |
| + RunCommand('test.bat') |
| def _FindInPath(filename): |
| for path in os.environ['PATH'].split(os.pathsep): |
| - result = os.path.join(path, filename) |
| + result = join(path, filename) |
| if os.path.exists(result): |
| return result |
| @@ -60,7 +95,7 @@ def _GetGsutil(): |
| # gsutil from the slave scripts folder |
| import slave |
| slave_dir = os.path.dirname(slave.__file__) |
| - gsutil = os.path.join(slave_dir, 'gsutil') |
| + gsutil = join(slave_dir, 'gsutil') |
| if os.name == 'nt': |
| gsutil += '.bat' |
| gsutil = [gsutil] |
| @@ -82,7 +117,7 @@ def StepArchive(): |
| Log('@@@BUILD_STEP Archiving %s@@@' % rev) |
| basename = 'vs_addin.tgz' |
| remote_name = '%s/%s/%s' % (GSPATH, rev, basename) |
| - local_filename = os.path.join('..', '..', 'out', |
| + local_filename = join('..', '..', 'out', |
| 'vs_addin', basename) |
| cmd = _GetGsutil() |
| cmd += ['cp', '-a', 'public-read', local_filename, |
| @@ -93,9 +128,11 @@ def StepArchive(): |
| def main(): |
| - StepBuild() |
| + #StepBuild() |
|
binji
2012/10/09 01:05:11
debugging?
Sam Clegg
2012/10/09 17:04:33
Done.
|
| + #StepInstall() |
| + StepInstallSDK() |
| StepTest() |
| - StepArchive() |
| + #StepArchive() |
| if __name__ == '__main__': |