xref: /aosp_15_r20/external/libchrome/build/android/pylib/pexpect.py (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
1*635a8641SAndroid Build Coastguard Worker# Copyright (c) 2012 The Chromium Authors. All rights reserved.
2*635a8641SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*635a8641SAndroid Build Coastguard Worker# found in the LICENSE file.
4*635a8641SAndroid Build Coastguard Workerfrom __future__ import absolute_import
5*635a8641SAndroid Build Coastguard Worker
6*635a8641SAndroid Build Coastguard Workerimport os
7*635a8641SAndroid Build Coastguard Workerimport sys
8*635a8641SAndroid Build Coastguard Worker
9*635a8641SAndroid Build Coastguard Worker_CHROME_SRC = os.path.join(
10*635a8641SAndroid Build Coastguard Worker    os.path.abspath(os.path.dirname(__file__)), '..', '..', '..')
11*635a8641SAndroid Build Coastguard Worker
12*635a8641SAndroid Build Coastguard Worker_PEXPECT_PATH = os.path.join(_CHROME_SRC, 'third_party', 'pexpect')
13*635a8641SAndroid Build Coastguard Workerif _PEXPECT_PATH not in sys.path:
14*635a8641SAndroid Build Coastguard Worker  sys.path.append(_PEXPECT_PATH)
15*635a8641SAndroid Build Coastguard Worker
16*635a8641SAndroid Build Coastguard Worker# pexpect is not available on all platforms. We allow this file to be imported
17*635a8641SAndroid Build Coastguard Worker# on platforms without pexpect and only fail when pexpect is actually used.
18*635a8641SAndroid Build Coastguard Workertry:
19*635a8641SAndroid Build Coastguard Worker  from pexpect import * # pylint: disable=W0401,W0614
20*635a8641SAndroid Build Coastguard Workerexcept ImportError:
21*635a8641SAndroid Build Coastguard Worker  pass
22