Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # Virtual Me2Me implementation. This script runs and manages the processes | 6 # Virtual Me2Me implementation. This script runs and manages the processes |
| 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop | 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop |
| 8 # session, and Host process. | 8 # session, and Host process. |
| 9 # This script is intended to run continuously as a background daemon | 9 # This script is intended to run continuously as a background daemon |
| 10 # process, running under an ordinary (non-root) user account. | 10 # process, running under an ordinary (non-root) user account. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 # defaults can be overridden in ~/.profile. | 48 # defaults can be overridden in ~/.profile. |
| 49 DEFAULT_SIZES = "1600x1200,3840x2560" | 49 DEFAULT_SIZES = "1600x1200,3840x2560" |
| 50 | 50 |
| 51 # If RANDR is not available, use a smaller default size. Only a single | 51 # If RANDR is not available, use a smaller default size. Only a single |
| 52 # resolution is supported in this case. | 52 # resolution is supported in this case. |
| 53 DEFAULT_SIZE_NO_RANDR = "1600x1200" | 53 DEFAULT_SIZE_NO_RANDR = "1600x1200" |
| 54 | 54 |
| 55 SCRIPT_PATH = os.path.abspath(sys.argv[0]) | 55 SCRIPT_PATH = os.path.abspath(sys.argv[0]) |
| 56 SCRIPT_DIR = os.path.dirname(SCRIPT_PATH) | 56 SCRIPT_DIR = os.path.dirname(SCRIPT_PATH) |
| 57 | 57 |
| 58 IS_INSTALLED = (os.path.basename(sys.argv[0]) != 'linux_me2me_host.py') | 58 IS_INSTALLED = ("me2me_host" not in os.path.basename(sys.argv[0])) |
| 59 | 59 |
| 60 if IS_INSTALLED: | 60 if IS_INSTALLED: |
| 61 HOST_BINARY_NAME = "chrome-remote-desktop-host" | 61 HOST_BINARY_NAME = "chrome-remote-desktop-host" |
| 62 else: | 62 else: |
| 63 HOST_BINARY_NAME = "remoting_me2me_host" | 63 HOST_BINARY_NAME = "remoting_me2me_host" |
| 64 | 64 |
| 65 CHROME_REMOTING_GROUP_NAME = "chrome-remote-desktop" | 65 CHROME_REMOTING_GROUP_NAME = "chrome-remote-desktop" |
| 66 | 66 |
| 67 HOME_DIR = os.environ["HOME"] | 67 HOME_DIR = os.environ["HOME"] |
| 68 CONFIG_DIR = os.path.join(HOME_DIR, ".config/chrome-remote-desktop") | 68 CONFIG_DIR = os.path.join(HOME_DIR, ".config/chrome-remote-desktop") |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 return [session_wrapper] | 629 return [session_wrapper] |
| 630 return None | 630 return None |
| 631 | 631 |
| 632 | 632 |
| 633 def locate_executable(exe_name): | 633 def locate_executable(exe_name): |
| 634 if IS_INSTALLED: | 634 if IS_INSTALLED: |
| 635 # If the script is running from its installed location, search the host | 635 # If the script is running from its installed location, search the host |
| 636 # binary only in the same directory. | 636 # binary only in the same directory. |
| 637 paths_to_try = [ SCRIPT_DIR ] | 637 paths_to_try = [ SCRIPT_DIR ] |
| 638 else: | 638 else: |
| 639 paths_to_try = map(lambda p: os.path.join(SCRIPT_DIR, p), | 639 paths_to_try = map(lambda p: os.path.join(SCRIPT_DIR, p), |
|
Sergey Ulanov
2016/04/12 23:53:20
If we expect this script to be in the same directo
Lambros
2016/04/14 18:12:58
Done. Since this removes out/{Debug,Release}, I ad
| |
| 640 [".", | 640 [".", |
| 641 "../../../out/Debug", | 641 "../../../out/Debug", |
| 642 "../../../out/Default", | 642 "../../../out/Default", |
| 643 "../../../out/Release"]) | 643 "../../../out/Release"]) |
| 644 for path in paths_to_try: | 644 for path in paths_to_try: |
| 645 exe_path = os.path.join(path, exe_name) | 645 exe_path = os.path.join(path, exe_name) |
| 646 if os.path.exists(exe_path): | 646 if os.path.exists(exe_path): |
| 647 return exe_path | 647 return exe_path |
| 648 | 648 |
| 649 raise Exception("Could not locate executable '%s'" % exe_name) | 649 raise Exception("Could not locate executable '%s'" % exe_name) |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1399 else: | 1399 else: |
| 1400 logging.info("Host exited with status %s." % os.WEXITSTATUS(status)) | 1400 logging.info("Host exited with status %s." % os.WEXITSTATUS(status)) |
| 1401 elif os.WIFSIGNALED(status): | 1401 elif os.WIFSIGNALED(status): |
| 1402 logging.info("Host terminated by signal %s." % os.WTERMSIG(status)) | 1402 logging.info("Host terminated by signal %s." % os.WTERMSIG(status)) |
| 1403 | 1403 |
| 1404 | 1404 |
| 1405 if __name__ == "__main__": | 1405 if __name__ == "__main__": |
| 1406 logging.basicConfig(level=logging.DEBUG, | 1406 logging.basicConfig(level=logging.DEBUG, |
| 1407 format="%(asctime)s:%(levelname)s:%(message)s") | 1407 format="%(asctime)s:%(levelname)s:%(message)s") |
| 1408 sys.exit(main()) | 1408 sys.exit(main()) |
| OLD | NEW |