aboutsummaryrefslogtreecommitdiff
path: root/cros_login.py
diff options
context:
space:
mode:
authorLuis Lozano <llozano@chromium.org>2015-12-15 13:49:30 -0800
committerLuis Lozano <llozano@chromium.org>2015-12-16 17:36:06 +0000
commitf2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe (patch)
tree185d243c7eed7c7a0db6f0e640746cadc1479ea9 /cros_login.py
parent2a66f70fef907c1cb15229cb58e5129cb620ac98 (diff)
downloadtoolchain-utils-f2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe.tar.gz
Run pyformat on all the toolchain-utils files.
This gets rid of a lot of lint issues. Ran by doing this: for f in *.py; do echo -n "$f " ; if [ -x $f ]; then pyformat -i --remove_trailing_comma --yapf --force_quote_type=double $f ; else pyformat -i --remove_shebang --remove_trailing_comma --yapf --force_quote_type=double $f ; fi ; done BUG=chromium:567921 TEST=Ran simple crosperf run. Change-Id: I59778835fdaa5f706d2e1765924389f9e97433d1 Reviewed-on: https://chrome-internal-review.googlesource.com/242031 Reviewed-by: Luis Lozano <llozano@chromium.org> Commit-Queue: Luis Lozano <llozano@chromium.org> Tested-by: Luis Lozano <llozano@chromium.org> Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'cros_login.py')
-rwxr-xr-xcros_login.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/cros_login.py b/cros_login.py
index 264b4429..b510444d 100755
--- a/cros_login.py
+++ b/cros_login.py
@@ -1,12 +1,11 @@
#!/usr/bin/python
#
# Copyright 2010 Google Inc. All Rights Reserved.
-
"""Script to get past the login screen of ChromeOS.
"""
-__author__ = "asharif@google.com (Ahmad Sharif)"
+__author__ = 'asharif@google.com (Ahmad Sharif)'
import datetime
import fcntl
@@ -25,14 +24,13 @@ from utils import command_executer
LOGIN_PROMPT_VISIBLE_MAGIC_FILE = '/tmp/uptime-login-prompt-visible'
LOGGED_IN_MAGIC_FILE = '/var/run/state/logged-in'
-
-script_header="""
+script_header = """
import os
import autox
import time
"""
-wait_for_login_screen="""
+wait_for_login_screen = """
while True:
print 'Waiting for login screen to appear...'
@@ -44,8 +42,7 @@ while True:
time.sleep(20)
""" % LOGIN_PROMPT_VISIBLE_MAGIC_FILE
-
-do_login="""
+do_login = """
xauth_filename = '/home/chronos/.Xauthority'
os.environ.setdefault('XAUTHORITY', xauth_filename)
os.environ.setdefault('DISPLAY', ':0.0')
@@ -76,20 +73,20 @@ while True:
print 'Done'
""" % LOGGED_IN_MAGIC_FILE
+
def RestartUI(remote, chromeos_root, login=True):
chromeos_root = os.path.expanduser(chromeos_root)
ce = command_executer.GetCommandExecuter()
# First, restart ui.
command = 'rm -rf %s && restart ui' % LOGIN_PROMPT_VISIBLE_MAGIC_FILE
- ce.CrosRunCommand(command, machine=remote,
- chromeos_root=chromeos_root)
+ ce.CrosRunCommand(command, machine=remote, chromeos_root=chromeos_root)
host_login_script = tempfile.mktemp()
device_login_script = '/tmp/login.py'
login_script_list = [script_header, wait_for_login_screen]
if login:
login_script_list.append(do_login)
- full_login_script_contents = "\n".join(login_script_list)
+ full_login_script_contents = '\n'.join(login_script_list)
with open(host_login_script, 'w') as f:
f.write(full_login_script_contents)
@@ -123,6 +120,7 @@ def Main(argv):
return RestartUI(options.remote, options.chromeos_root)
+
if __name__ == '__main__':
retval = Main(sys.argv)
sys.exit(retval)