Chromium Code Reviews| Index: visual_studio/NativeClientVSAddIn/InstallerResources/install.py |
| diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/install.py b/visual_studio/NativeClientVSAddIn/InstallerResources/install.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a4fead53e9c42e09c2b69c1f63e71962f15000cf |
| --- /dev/null |
| +++ b/visual_studio/NativeClientVSAddIn/InstallerResources/install.py |
| @@ -0,0 +1,36 @@ |
| +#!/usr/bin/env python |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +"""Copies necessary add-in files into place to install the add-in. |
| + |
| +This script will copy the necessary files for the Visual Studio add-in |
| +to where Visual Studio can find them. It assumes the current directory |
| +contains the necessary files to copy. |
| +""" |
| + |
| +import os |
| +import platform |
| +import shutil |
| + |
| +def main(): |
| + if platform.system() != 'Windows': |
| + raise Exception('Must install to Windows system') |
| + |
| + # Ensure environment variables are set |
| + nacl_sdk_root = os.path.expandvars('%NACL_SDK_ROOT%', None) |
|
binji
2012/07/17 17:38:55
I still like os.getenv better here (it doesn't req
|
| + chrome_path = os.path.expandvars('%CHROME_PATH%', None) |
| + if nacl_sdk_root == None: |
|
binji
2012/07/17 17:38:55
Tests against None are usually written
if nacl_sd
|
| + raise Exception('Environment Variable NACL_SDK_ROOT is not set') |
| + if chrome_path == None: |
| + raise Exception('Environment Variable CHROME_PATH is not set') |
| + |
| + # Copy the necessary files into place |
| + addInDir = os.path.expandvars( |
|
binji
2012/07/17 17:38:55
nit: should be add_in_dir
|
| + '%USERPROFILE%\My Documents\Visual Studio 2010\Addins') |
| + shutil.copy('./NativeClientVSAddIn.AddIn', addInDir) |
| + shutil.copy('./NativeClientVSAddIn.dll', addInDir) |
| + |
| +if __name__ == '__main__': |
| + main() |