Additional improvements to install scripts
Continued from issue 10790023
Changed os.path.expandvars to os.getenv where possible, removed unused imports.
http://codereview.chromium.org/10790023/diff/12/visual_studio/NativeClientVSA...
File visual_studio/NativeClientVSAddIn/InstallerResources/install.py (right):
http://codereview.chromium.org/10790023/diff/12/visual_studio/NativeClientVSA...
visual_studio/NativeClientVSAddIn/InstallerResources/install.py:22:
nacl_sdk_root = os.path.expandvars('%NACL_SDK_ROOT%', None)
I still like os.getenv better here (it doesn't require the platform specific
%VAR%), but OK
http://codereview.chromium.org/10790023/diff/12/visual_studio/NativeClientVSA...
visual_studio/NativeClientVSAddIn/InstallerResources/install.py:24: if
nacl_sdk_root == None:
Tests against None are usually written
if nacl_sdk_root is None:
or
if nacl_sdk_root:
http://codereview.chromium.org/10790023/diff/12/visual_studio/NativeClientVSA...
visual_studio/NativeClientVSAddIn/InstallerResources/install.py:30: addInDir =
os.path.expandvars(
nit: should be add_in_dir
http://codereview.chromium.org/10790023/diff/12/visual_studio/NativeClientVSA...
File visual_studio/NativeClientVSAddIn/create_package.py (right):
http://codereview.chromium.org/10790023/diff/12/visual_studio/NativeClientVSA...
visual_studio/NativeClientVSAddIn/create_package.py:13: import glob
nit: can remove, not used anymore
http://codereview.chromium.org/10790023/diff/12/visual_studio/NativeClientVSA...
visual_studio/NativeClientVSAddIn/create_package.py:15: import shutil
same here
http://codereview.chromium.org/10790023/diff/12/visual_studio/NativeClientVSA...
visual_studio/NativeClientVSAddIn/create_package.py:31: FILE_LIST = [
Nice, a lot easier to read now
BUG=136414
TEST=
Review URL: https://chromiumcodereview.appspot.com/10790039
git-svn-id: https://nativeclient-sdk.googlecode.com/svn/trunk/src@1403 050acbb0-2703-11df-ab0a-9f3f633ae91d
diff --git a/InstallerResources/install.py b/InstallerResources/install.py
index a4fead5..5ce7c66 100644
--- a/InstallerResources/install.py
+++ b/InstallerResources/install.py
@@ -19,18 +19,18 @@
raise Exception('Must install to Windows system')
# Ensure environment variables are set
- nacl_sdk_root = os.path.expandvars('%NACL_SDK_ROOT%', None)
- chrome_path = os.path.expandvars('%CHROME_PATH%', None)
- if nacl_sdk_root == None:
+ nacl_sdk_root = os.getenv('NACL_SDK_ROOT', None)
+ chrome_path = os.getenv('CHROME_PATH', None)
+ if nacl_sdk_root is None:
raise Exception('Environment Variable NACL_SDK_ROOT is not set')
- if chrome_path == None:
+ if chrome_path is None:
raise Exception('Environment Variable CHROME_PATH is not set')
# Copy the necessary files into place
- addInDir = os.path.expandvars(
+ add_in_directory = os.path.expandvars(
'%USERPROFILE%\My Documents\Visual Studio 2010\Addins')
- shutil.copy('./NativeClientVSAddIn.AddIn', addInDir)
- shutil.copy('./NativeClientVSAddIn.dll', addInDir)
+ shutil.copy('./NativeClientVSAddIn.AddIn', add_in_directory)
+ shutil.copy('./NativeClientVSAddIn.dll', add_in_directory)
if __name__ == '__main__':
main()
diff --git a/create_package.py b/create_package.py
index 1eab99d..e5bc0f8 100644
--- a/create_package.py
+++ b/create_package.py
@@ -10,9 +10,7 @@
result in out/NativeClientVSAddin.zip
"""
-import glob
import os
-import shutil
import zipfile
# Root output directory