OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS 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 """Common python commands used by various build scripts.""" | 5 """Common python commands used by various build scripts.""" |
6 | 6 |
7 import inspect | 7 import inspect |
8 import os | 8 import os |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
11 import sys | 11 import sys |
12 | 12 |
13 _STDOUT_IS_TTY = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() | 13 _STDOUT_IS_TTY = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() |
14 CROSUTILS_DIRECTORY = os.path.realpath(os.path.dirname(os.path.dirname( | 14 CROSUTILS_DIRECTORY = os.path.dirname(os.path.dirname( |
15 __file__))) | 15 os.path.realpath(__file__))) |
16 | 16 |
17 # TODO(sosa): Move logging to logging module. | 17 # TODO(sosa): Move logging to logging module. |
18 | 18 |
19 class RunCommandException(Exception): | 19 class RunCommandException(Exception): |
20 """Raised when there is an error in RunCommand.""" | 20 """Raised when there is an error in RunCommand.""" |
21 pass | 21 pass |
22 | 22 |
23 | 23 |
24 def GetCallerName(): | 24 def GetCallerName(): |
25 """Returns the name of the calling module with __main__.""" | 25 """Returns the name of the calling module with __main__.""" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 | 320 |
321 def UnmountImage(root_dir, stateful_dir): | 321 def UnmountImage(root_dir, stateful_dir): |
322 """Unmounts a Chromium OS image specified by mount dir points.""" | 322 """Unmounts a Chromium OS image specified by mount dir points.""" |
323 RunCommand(['./mount_gpt_image.sh', | 323 RunCommand(['./mount_gpt_image.sh', |
324 '--unmount', | 324 '--unmount', |
325 '--rootfs_mountpt=%s' % root_dir, | 325 '--rootfs_mountpt=%s' % root_dir, |
326 '--stateful_mountpt=%s' % stateful_dir, | 326 '--stateful_mountpt=%s' % stateful_dir, |
327 ], print_cmd=False, redirect_stdout=True, redirect_stderr=True, | 327 ], print_cmd=False, redirect_stdout=True, redirect_stderr=True, |
328 cwd=CROSUTILS_DIRECTORY) | 328 cwd=CROSUTILS_DIRECTORY) |
OLD | NEW |