Chromium Code Reviews| Index: tools/win/split_link/check_installed.py |
| diff --git a/tools/win/split_link/check_installed.py b/tools/win/split_link/check_installed.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8d8148f359389cc1a35dcf2f26820c868b27ff28 |
| --- /dev/null |
| +++ b/tools/win/split_link/check_installed.py |
| @@ -0,0 +1,47 @@ |
| +# Copyright (c) 2013 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. |
| + |
| +import os |
| +import sys |
| + |
| + |
| +def IsAvailable(): |
| + _winreg = None |
| + if sys.platform == 'win32': |
| + import _winreg |
| + elif sys.platform == 'cygwin': |
| + try: |
| + import cygwinreg as _winreg |
| + except ImportError: |
| + pass # If not available, be safe and write 0. |
| + |
| + if not _winreg: |
| + return False |
| + |
| + try: |
| + val = _winreg.QueryValue(_winreg.HKEY_CURRENT_USER, |
| + 'Software\\Chromium\\split_link_installed') |
| + if os.path.exists(val): |
|
M-A Ruel
2013/05/14 00:39:09
return os.path.exists(val)
works just fine.
scottmg
2013/05/14 03:35:07
Done.
|
| + return True |
| + except WindowsError: |
| + pass |
| + |
| + return False |
| + |
| + |
| +def main(): |
| + # Can be called from gyp to set variable. |
| + if IsAvailable(): |
| + sys.stdout.write('1') |
| + else: |
| + print >>sys.stderr, "Couldn't find split_link installation." |
| + print >>sys.stderr, ('Run python tools\\win\\split_link\\' |
| + 'install_split_link.py from an elevated Visual ' |
| + 'Studio Command Prompt to install.') |
| + sys.stdout.write('0') |
| + return 1 |
| + |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |