Android device status: create out dir if needed

- I recently changed device status to run before gyp
  This exposed a dependence on the out directory
  existing and broke new android testers.

TEST=Ran device status with --out-dir pointing to
     non-existent dir.

R=bulach@chromium.org
BUG=

Review URL: https://codereview.chromium.org/10962022

git-svn-id: http://src.chromium.org/svn/trunk/src/build@158075 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
ilevy@chromium.org 2012-09-21 21:07:30 +00:00
Родитель b1744c8c01
Коммит 2056e99605
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -58,9 +58,8 @@ def CheckForMissingDevices(options, adb_online_devs):
adb_online_devs: A list of serial numbers of the currently visible
and online attached devices.
"""
last_devices_path = os.path.abspath(os.path.join(options.out_dir,
'.last_devices'))
out_dir = os.path.abspath(options.out_dir)
last_devices_path = os.path.join(out_dir, '.last_devices')
last_devices = []
try:
with open(last_devices_path) as f:
@ -89,8 +88,10 @@ def CheckForMissingDevices(options, adb_online_devs):
print ('New devices detected %s. And now back to your '
'regularly scheduled program.' % list(new_devs))
# Write devices currently visible plus devices previously seen.
if not os.path.exists(out_dir):
os.makedirs(out_dir)
with open(last_devices_path, 'w') as f:
# Write devices currently visible plus devices previously seen.
f.write('\n'.join(set(adb_online_devs + last_devices)))