diff options
author | rnk@chromium.org <rnk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-24 21:09:12 +0000 |
---|---|---|
committer | rnk@chromium.org <rnk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-24 21:09:12 +0000 |
commit | 19730637881ccc08ed398733df58445023bdad1b (patch) | |
tree | a2157a18ab5bbfdbfecefccec464840521199854 /tools | |
parent | f74d2b90be94b3652fa55afd235cb7ddeded11c4 (diff) | |
download | chromium_src-19730637881ccc08ed398733df58445023bdad1b.zip chromium_src-19730637881ccc08ed398733df58445023bdad1b.tar.gz chromium_src-19730637881ccc08ed398733df58445023bdad1b.tar.bz2 |
Port the supalink scripts to work with Cygwin Python.
Annoyingly, _winreg doesn't exist in Cygwin Python. cygwinreg is a
third party compatible alternative, though. Installing it and making
these changes was the quickest way to get supalink working for me.
R=scottmg@chromium.org
BUG=
TEST=ran both scripts, supalink works for me
Review URL: http://codereview.chromium.org/9463015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123546 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/win/supalink/check_installed.py | 15 | ||||
-rwxr-xr-x | tools/win/supalink/install_supalink.py | 12 |
2 files changed, 21 insertions, 6 deletions
diff --git a/tools/win/supalink/check_installed.py b/tools/win/supalink/check_installed.py index 00b2b59..1d089f4 100755 --- a/tools/win/supalink/check_installed.py +++ b/tools/win/supalink/check_installed.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# 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. @@ -7,12 +7,19 @@ import sys import os def main(): - if sys.platform != 'win32': + _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: sys.stdout.write('0') return 0 - import _winreg - try: val = _winreg.QueryValue(_winreg.HKEY_CURRENT_USER, 'Software\\Chromium\\supalink_installed') diff --git a/tools/win/supalink/install_supalink.py b/tools/win/supalink/install_supalink.py index 6aeaa06..ab445c1 100755 --- a/tools/win/supalink/install_supalink.py +++ b/tools/win/supalink/install_supalink.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# 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. @@ -8,7 +8,15 @@ import shutil import subprocess import sys import tempfile -import _winreg + +if sys.platform == 'win32': + import _winreg +elif sys.platform == 'cygwin': + try: + import cygwinreg as _winreg + except ImportError: + print "Please install cygwinreg so I can access the registry." + print "Install setuptools and run 'easy_install cygwinreg'." VSVARS_PATH = ('C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\' |