diff options
| author | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2005-11-22 07:36:30 +0000 |
|---|---|---|
| committer | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2005-11-22 07:36:30 +0000 |
| commit | 662e576cb8dc8aa4f5124aadba95048117bbfd7d (patch) | |
| tree | 26e625784fa4d5e2d57e04cf673c6e0df01b4e21 /pexpect | |
| parent | 48ef4b13f3d40942f52f8a9623033beb1c698857 (diff) | |
| download | pexpect-662e576cb8dc8aa4f5124aadba95048117bbfd7d.tar.gz | |
Added LICENSE file. Changed license to MIT. Doted on the docs.
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@342 656d521f-e311-0410-88e0-e7920216d269
Diffstat (limited to 'pexpect')
| -rw-r--r-- | pexpect/LICENSE | 21 | ||||
| -rw-r--r-- | pexpect/MANIFEST | 1 | ||||
| -rw-r--r-- | pexpect/Makefile | 2 | ||||
| -rw-r--r-- | pexpect/README | 21 | ||||
| -rw-r--r-- | pexpect/doc/clean.css | 4 | ||||
| -rw-r--r-- | pexpect/doc/index.html | 37 | ||||
| -rw-r--r-- | pexpect/pexpect.py | 104 | ||||
| -rw-r--r-- | pexpect/setup.py | 6 |
8 files changed, 146 insertions, 50 deletions
diff --git a/pexpect/LICENSE b/pexpect/LICENSE new file mode 100644 index 0000000..4b83f63 --- /dev/null +++ b/pexpect/LICENSE @@ -0,0 +1,21 @@ +Free, open source, and all that good stuff. +Pexpect Copyright (c) 2005 Noah Spurrier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/pexpect/MANIFEST b/pexpect/MANIFEST index c660ab4..db37ab3 100644 --- a/pexpect/MANIFEST +++ b/pexpect/MANIFEST @@ -1,4 +1,5 @@ README +LICENSE setup.py pexpect.py pxssh.py diff --git a/pexpect/Makefile b/pexpect/Makefile index a73550d..e4209fc 100644 --- a/pexpect/Makefile +++ b/pexpect/Makefile @@ -1,6 +1,6 @@ SHELL = /bin/sh -VERSION=2.0 +VERSION=2.1 #DOCGENERATOR= happydoc DOCGENERATOR= pydoc -w # This is for GNU Make. This does not work on BSD Make. diff --git a/pexpect/README b/pexpect/README index c07a635..d7f2a78 100644 --- a/pexpect/README +++ b/pexpect/README @@ -16,7 +16,26 @@ Python, Pexpect does not require TCL or Expect nor does it require C extensions to be compiled. It should work on any platform that supports the standard Python pty module. The Pexpect interface was designed to be easy to use. -License: Python Software Foundation License +Free, open source, and all that good stuff. +Pexpect Copyright (c) 2005 Noah Spurrier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. Noah Spurrier http://pexpect.sourceforge.net/ diff --git a/pexpect/doc/clean.css b/pexpect/doc/clean.css index 596112b..e8d98dd 100644 --- a/pexpect/doc/clean.css +++ b/pexpect/doc/clean.css @@ -38,8 +38,8 @@ h3 { } p { - font:11px/20px verdana, arial, helvetica, sans-serif; margin:0px 0px 16px 0px; + font:11px/20px verdana, arial, helvetica, sans-serif; padding:0px; } table @@ -55,7 +55,7 @@ th.pymenu {color: #ffffff; background-color: #003366} .code { font-family: "Lucida Console", monospace; font-weight: bold; - color: #007700; background-color: #dddddd + color: #007700; background-color: #eeeeee } #Content>p {margin:0px;} diff --git a/pexpect/doc/index.html b/pexpect/doc/index.html index 6f41308..b62618d 100644 --- a/pexpect/doc/index.html +++ b/pexpect/doc/index.html @@ -12,7 +12,7 @@ </head> <body bgcolor="#ffffff" text="#000000"> <div id="Header"> -<h1>Pexpect version 2.0<br> +<h1>Pexpect version 2.1<br> a Pure Python Expect-like module </h1> </div> @@ -44,11 +44,32 @@ Pexpect interface was designed to be easy to use.</p> </tbody> </table> <hr noshade="noshade" size="1"> -<h1><a name="license"></a>License</h1> -<p>Pexpect is Open Source, free, and all that stuff.<br> -It is licensed under the <a - href="http://www.opensource.org/licenses/PythonSoftFoundation.html">Python -Software Foundation License</a>.</p> +<h1><a name="license"></a>License: MIT style</h1> +<p> +Free, open source, and all that good stuff.<br> +<br> +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions:<br> +<br> +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software.<br> +<br> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE.<br> +<br> +Pexpect Copyright (c) 2005 Noah Spurrier<br> +http://pexpect.sourceforge.net/ +</p> + <hr noshade="noshade" size="1"> <h1><a name="download"></a><a href="http://sourceforge.net/project/showfiles.php?group_id=59762">Download</a></h1> @@ -204,8 +225,8 @@ confidence in Pexpect on Python 1.5.2.</p> module should be able to run Pexpect. The <span class="code">pty</span> module is part of the Standard Python Library, so if you are running on a POSIX system you should have it. The <span class="code">pty</span> -module does not run as well on all platforms. I have taken effort to -try to smooth the wrinkles out the different platforms. To learn more +module does not run the same on all platforms. I have taken effort to +try to smooth the wrinkles out of the different platforms. To learn more about the wrinkles see <a href="#bugs">Bugs</a> and <a href="#testing">Testing</a>.</p> </blockquote> <p>Pexpect does not currently work on the standard Windows Python(see diff --git a/pexpect/pexpect.py b/pexpect/pexpect.py index ea922ce..c44e0bb 100644 --- a/pexpect/pexpect.py +++ b/pexpect/pexpect.py @@ -11,45 +11,68 @@ 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 Pexpect. You can call the function: - pexpect.run() -to execute a command and return the output. -Do no use this on interactive commands that expect input. -This is a handy replacment for os.system(). -The more useful interface is the class: - pexpect.spawn() -This creates a spawn instance. This will start the command that you specify. -You can then interact with the child command through the spawn instance. -Most commands, including ssh, cannot tell that they are being run inside -of a script. This works even for commands that ask for passwords or -other input outside of the normal stdio streams. - -Pexpect is Open Source, Free, and all that good stuff. -License: Python Software Foundation License - http://www.opensource.org/licenses/PythonSoftFoundation.html - -Noah Spurrier -Richard Holden -Marco Molteni -Kimberley Burchett -Robert Stone -Mike Snitzer -Marti Raudsepp -Matt <matt (*) corvil.com> -Hartmut Goebel -Chad Schroeder -Erick Tryzelaar -Dave Kirby -Ids vander Molen -George Todd -Noel Taylor -Nicolas D. Cesar +There are two main interfaces to Pexpect -- the function, run() and +the class, spawn. You can call the run() function to execute a command +and return the output. This is a handy replacement for os.system(). +For example: + pexpect.run('ls -la') +The more powerful interface is the spawn class. You can create an +insteance of an external command and use spawn to interact with +the +You can use this to spawn an external child command and then +interact with the child by sending lines and expecting responses. +For example: + child = pexpect.spawn('scp foo myname@host.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. + +Credits: + Noah Spurrier + Richard Holden + Marco Molteni + Kimberley Burchett + Robert Stone + Mike Snitzer + Marti Raudsepp + Matt <matt (*) corvil.com> + Hartmut Goebel + Chad Schroeder + Erick Tryzelaar + Dave Kirby + Ids vander Molen + George Todd + Noel Taylor + Nicolas D. Cesar (Let me know if I forgot anyone.) +Free, open source, and all that good stuff. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + +Pexpect Copyright (c) 2005 Noah Spurrier +http://pexpect.sourceforge.net/ + $Revision$ $Date$ """ - try: import os, sys, time import select @@ -70,7 +93,7 @@ except ImportError, e: A critical module was not found. Probably this operating system does not support it. Pexpect is intended for UNIX-like operating systems.""") -__version__ = '2.0' +__version__ = '2.1' __revision__ = '$Revision$' __all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', 'which', 'split_command_line', '__version__', '__revision__'] @@ -122,6 +145,17 @@ def run (command, timeout=-1, withexitstatus=0, events=None, extra_args=None): (command_output, exitstatus). If withexitstatus is false then this returns just command_output. + The run() function can often be used instead of creating a spawn instance. + For example, the following code uses spawn: + from pexpect import * + child = spawn('scp foo myname@host.example.com:.') + child.expect ('(?i)password') + child.sendline (mypassword) + The previous code can be replace with the following, which you may + or may not find simpler: + from pexpect import * + run ('scp foo myname@host.example.com:.', events={'(?i)password': mypassword}) + Examples: Start the apache daemon on the local machine: from pexpect import * diff --git a/pexpect/setup.py b/pexpect/setup.py index d780b7d..b80753d 100644 --- a/pexpect/setup.py +++ b/pexpect/setup.py @@ -4,13 +4,13 @@ $Date$ ''' from distutils.core import setup setup (name='pexpect', - version='2.0', - py_modules=['pexpect'], + version='2.1', + py_modules=['pexpect', 'pxssh'], description='Pexpect is a pure Python Expect. It allows easy control of other applications.', author='Noah Spurrier', author_email='noah@noah.org', url='http://pexpect.sourceforge.net/', - license='Python Software Foundation License', + license='MIT license', platforms='UNIX', ) |
