1'''Pexpect is a Python module for spawning child applications and controlling
2them automatically. Pexpect can be used for automating interactive applications
3such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup
4scripts for duplicating software package installations on different servers. It
5can be used for automated software testing. Pexpect is in the spirit of Don
6Libes' Expect, but Pexpect is pure Python. Other Expect-like modules for Python
7require TCL and Expect or require C extensions to be compiled. Pexpect does not
8use C, Expect, or TCL extensions. It should work on any platform that supports
9the standard Python pty module. The Pexpect interface focuses on ease of use so
10that simple tasks are easy.
11
12There are two main interfaces to the Pexpect system; these are the function,
13run() and the class, spawn. The spawn class is more powerful. The run()
14function is simpler than spawn, and is good for quickly calling program. When
15you call the run() function it executes a given program and then returns the
16output. This is a handy replacement for os.system().
17
18For example::
19
20    pexpect.run('ls -la')
21
22The spawn class is the more powerful interface to the Pexpect system. You can
23use this to spawn a child program then interact with it by sending input and
24expecting responses (waiting for patterns in the child's output).
25
26For example::
27
28    child = pexpect.spawn('scp foo user@example.com:.')
29    child.expect('Password:')
30    child.sendline(mypassword)
31
32This works even for commands that ask for passwords or other input outside of
33the normal stdio streams. For example, ssh reads input directly from the TTY
34device which bypasses stdin.
35
36Credits: Noah Spurrier, Richard Holden, Marco Molteni, Kimberley Burchett,
37Robert Stone, Hartmut Goebel, Chad Schroeder, Erick Tryzelaar, Dave Kirby, Ids
38vander Molen, George Todd, Noel Taylor, Nicolas D. Cesar, Alexander Gattin,
39Jacques-Etienne Baudoux, Geoffrey Marshall, Francisco Lourenco, Glen Mabey,
40Karthik Gurusamy, Fernando Perez, Corey Minyard, Jon Cohen, Guillaume
41Chazarain, Andrew Ryan, Nick Craig-Wood, Andrew Stone, Jorgen Grahn, John
42Spiegel, Jan Grant, and Shane Kerr. Let me know if I forgot anyone.
43
44Pexpect is free, open source, and all that good stuff.
45http://pexpect.sourceforge.net/
46
47PEXPECT LICENSE
48
49    This license is approved by the OSI and FSF as GPL-compatible.
50        http://opensource.org/licenses/isc-license.txt
51
52    Copyright (c) 2012, Noah Spurrier <noah@noah.org>
53    PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
54    PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE
55    COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES.
56    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
57    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
58    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
59    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
60    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
61    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
62    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
63
64'''
65
66import sys
67PY3 = (sys.version_info[0] >= 3)
68
69from .exceptions import ExceptionPexpect, EOF, TIMEOUT
70from .utils import split_command_line, which, is_executable_file
71from .expect import Expecter, searcher_re, searcher_string
72
73if sys.platform != 'win32':
74    # On Unix, these are available at the top level for backwards compatibility
75    from .pty_spawn import spawn, spawnu
76    from .run import run, runu
77
78__version__ = '4.6.0'
79__revision__ = ''
80__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'spawnu', 'run', 'runu',
81           'which', 'split_command_line', '__version__', '__revision__']
82
83
84
85# vim: set shiftround expandtab tabstop=4 shiftwidth=4 ft=python autoindent :
86