OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import sys | 6 import sys |
7 | 7 |
8 _SCRIPT_PATH = os.path.dirname(sys.argv[0]) | 8 _SCRIPT_PATH = os.path.dirname(sys.argv[0]) |
9 if _SCRIPT_PATH == "": | 9 if _SCRIPT_PATH == "": |
10 _SCRIPT_PATH = os.getcwd() | 10 _SCRIPT_PATH = os.getcwd() |
11 | 11 |
12 _EXE_PATHS_TO_TRY = [ | 12 _EXE_PATHS_TO_TRY = [ |
13 '.', | 13 '.', |
14 '..\\..\\build\\Debug', | 14 '..\\..\\build\\Debug', |
15 '..\\..\\build\\Release', | 15 '..\\..\\build\\Release', |
16 '..\\Debug', | 16 '..\\Debug', |
17 '..\\Release', | 17 '..\\Release', |
18 '../../xcodebuild/Debug', | 18 '../../xcodebuild/Debug', |
19 '../../xcodebuild/Release', | 19 '../../xcodebuild/Release', |
20 '../../out/Debug', | 20 '../../out/Debug', |
21 '../../out/Release'] | 21 '../../out/Release', |
| 22 '/usr/lib/chrome-remote-desktop'] |
22 | 23 |
23 | 24 |
24 def locate_executable(exe_name): | 25 def locate_executable(exe_name): |
25 for path in _EXE_PATHS_TO_TRY: | 26 for path in _EXE_PATHS_TO_TRY: |
26 exe_path = os.path.join(_SCRIPT_PATH, path, exe_name) | 27 exe_path = os.path.join(_SCRIPT_PATH, path, exe_name) |
27 if os.path.exists(exe_path): | 28 if os.path.exists(exe_path): |
28 return exe_path | 29 return exe_path |
29 exe_path = exe_path + ".exe" | 30 exe_path = exe_path + ".exe" |
30 if os.path.exists(exe_path): | 31 if os.path.exists(exe_path): |
31 return exe_path | 32 return exe_path |
32 | 33 |
33 raise Exception("Could not locate executable '%s'" % exe_name) | 34 raise Exception("Could not locate executable '%s'" % exe_name) |
34 | 35 |
35 | 36 |
36 def generateRSAKeyPair(): | 37 def generateRSAKeyPair(): |
37 """Returns (priv, pub) keypair where priv is a new private key and | 38 """Returns (priv, pub) keypair where priv is a new private key and |
38 pub is the corresponding public key. Both keys are BASE64 encoded.""" | 39 pub is the corresponding public key. Both keys are BASE64 encoded.""" |
39 keygen_path = locate_executable("remoting_host_keygen") | 40 keygen_path = locate_executable("remoting_host_keygen") |
40 pipe = os.popen(keygen_path) | 41 pipe = os.popen(keygen_path) |
41 out = pipe.readlines() | 42 out = pipe.readlines() |
42 if len(out) != 2: | 43 if len(out) != 2: |
43 raise Exception("remoting_host_keygen failed.") | 44 raise Exception("remoting_host_keygen failed.") |
44 return (out[0].strip(), out[1].strip()) | 45 return (out[0].strip(), out[1].strip()) |
OLD | NEW |