| Index: third_party/pexpect/pexpect/__init__.py
|
| diff --git a/third_party/pexpect/pexpect/__init__.py b/third_party/pexpect/pexpect/__init__.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..113ca223fbc2a15cfdabfcf28a1c4ddfd0ca678e
|
| --- /dev/null
|
| +++ b/third_party/pexpect/pexpect/__init__.py
|
| @@ -0,0 +1,85 @@
|
| +'''Pexpect is a Python module for spawning child applications and controlling
|
| +them automatically. Pexpect can be used for automating interactive applications
|
| +such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup
|
| +scripts for duplicating software package installations on different servers. It
|
| +can be used for automated software testing. Pexpect is in the spirit of Don
|
| +Libes' Expect, but Pexpect is pure Python. Other Expect-like modules for Python
|
| +require TCL and Expect or require C extensions to be compiled. Pexpect does not
|
| +use C, Expect, or TCL extensions. It should work on any platform that supports
|
| +the standard Python pty module. The Pexpect interface focuses on ease of use so
|
| +that simple tasks are easy.
|
| +
|
| +There are two main interfaces to the Pexpect system; these are the function,
|
| +run() and the class, spawn. The spawn class is more powerful. The run()
|
| +function is simpler than spawn, and is good for quickly calling program. When
|
| +you call the run() function it executes a given program and then returns the
|
| +output. This is a handy replacement for os.system().
|
| +
|
| +For example::
|
| +
|
| + pexpect.run('ls -la')
|
| +
|
| +The spawn class is the more powerful interface to the Pexpect system. You can
|
| +use this to spawn a child program then interact with it by sending input and
|
| +expecting responses (waiting for patterns in the child's output).
|
| +
|
| +For example::
|
| +
|
| + child = pexpect.spawn('scp foo user@example.com:.')
|
| + child.expect('Password:')
|
| + child.sendline(mypassword)
|
| +
|
| +This works even for commands that ask for passwords or other input outside of
|
| +the normal stdio streams. For example, ssh reads input directly from the TTY
|
| +device which bypasses stdin.
|
| +
|
| +Credits: Noah Spurrier, Richard Holden, Marco Molteni, Kimberley Burchett,
|
| +Robert Stone, Hartmut Goebel, Chad Schroeder, Erick Tryzelaar, Dave Kirby, Ids
|
| +vander Molen, George Todd, Noel Taylor, Nicolas D. Cesar, Alexander Gattin,
|
| +Jacques-Etienne Baudoux, Geoffrey Marshall, Francisco Lourenco, Glen Mabey,
|
| +Karthik Gurusamy, Fernando Perez, Corey Minyard, Jon Cohen, Guillaume
|
| +Chazarain, Andrew Ryan, Nick Craig-Wood, Andrew Stone, Jorgen Grahn, John
|
| +Spiegel, Jan Grant, and Shane Kerr. Let me know if I forgot anyone.
|
| +
|
| +Pexpect is free, open source, and all that good stuff.
|
| +http://pexpect.sourceforge.net/
|
| +
|
| +PEXPECT LICENSE
|
| +
|
| + This license is approved by the OSI and FSF as GPL-compatible.
|
| + http://opensource.org/licenses/isc-license.txt
|
| +
|
| + Copyright (c) 2012, Noah Spurrier <noah@noah.org>
|
| + PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
|
| + PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE
|
| + COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES.
|
| + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
| + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
| + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
| + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
| + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
| + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
| + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
| +
|
| +'''
|
| +
|
| +import sys
|
| +PY3 = (sys.version_info[0] >= 3)
|
| +
|
| +from .exceptions import ExceptionPexpect, EOF, TIMEOUT
|
| +from .utils import split_command_line, which, is_executable_file
|
| +from .expect import Expecter, searcher_re, searcher_string
|
| +
|
| +if sys.platform != 'win32':
|
| + # On Unix, these are available at the top level for backwards compatibility
|
| + from .pty_spawn import spawn, spawnu
|
| + from .run import run, runu
|
| +
|
| +__version__ = '4.1.dev'
|
| +__revision__ = ''
|
| +__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'spawnu', 'run', 'runu',
|
| + 'which', 'split_command_line', '__version__', '__revision__']
|
| +
|
| +
|
| +
|
| +# vim: set shiftround expandtab tabstop=4 shiftwidth=4 ft=python autoindent :
|
|
|