mirror of
https://github.com/clearml/wexpect-venv
synced 2025-03-13 06:58:10 +00:00
[ADD] common versioning
This commit is contained in:
parent
af8f24421b
commit
82326f0a85
13
setup.py
13
setup.py
@ -4,6 +4,11 @@ import sys
|
||||
from shutil import rmtree
|
||||
import setuptools
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
# Import the *local* wexpect:
|
||||
sys.path.insert(0, here)
|
||||
import wexpect
|
||||
|
||||
# Package meta-data.
|
||||
NAME = 'wexpect'
|
||||
DESCRIPTION = 'Windows alternative of pexpect'
|
||||
@ -11,7 +16,7 @@ URL = 'https://github.com/raczben/wexpect'
|
||||
EMAIL = 'betontalpfa@gmail.com'
|
||||
AUTHOR = '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, 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, Benedek Racz'
|
||||
REQUIRES_PYTHON = '>=2.7.0'
|
||||
VERSION = '0.0.2'
|
||||
VERSION = wexpect.__version__
|
||||
|
||||
# What packages are required for this module to be executed?
|
||||
REQUIRED = [
|
||||
@ -23,12 +28,6 @@ EXTRAS = {
|
||||
# 'fancy feature': ['django'],
|
||||
}
|
||||
|
||||
# The rest you shouldn't have to touch too much :)
|
||||
# ------------------------------------------------
|
||||
# Except, perhaps the License and Trove Classifiers!
|
||||
# If you do change the License, remember to change the Trove Classifier for that!
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
# Import the README and use it as the long-description.
|
||||
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
|
||||
|
18
wexpect.py
18
wexpect.py
@ -105,7 +105,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.3'
|
||||
__version__ = '2.3.1'
|
||||
__revision__ = '$Revision: 399 $'
|
||||
__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', 'which',
|
||||
'split_command_line', '__version__', '__revision__']
|
||||
@ -178,32 +178,25 @@ def run (command, timeout=-1, withexitstatus=False, events=None, extra_args=None
|
||||
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::
|
||||
|
||||
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 *
|
||||
run ("/usr/local/apache/bin/apachectl start")
|
||||
|
||||
Check in a file using SVN::
|
||||
|
||||
from pexpect import *
|
||||
run ("svn ci -m 'automatic commit' my_file.py")
|
||||
|
||||
Run a command and capture exit status::
|
||||
|
||||
from pexpect import *
|
||||
(command_output, exitstatus) = run ('ls -l /bin', withexitstatus=1)
|
||||
|
||||
Tricky Examples
|
||||
@ -217,11 +210,6 @@ def run (command, timeout=-1, withexitstatus=False, events=None, extra_args=None
|
||||
This will start mencoder to rip a video from DVD. This will also display
|
||||
progress ticks every 5 seconds as it runs. For example::
|
||||
|
||||
from pexpect import *
|
||||
def print_ticks(d):
|
||||
print d['event_count'],
|
||||
run ("mencoder dvd://1 -o video.avi -oac copy -ovc copy", events={TIMEOUT:print_ticks}, timeout=5)
|
||||
|
||||
The 'events' argument should be a dictionary of patterns and responses.
|
||||
Whenever one of the patterns is seen in the command out run() will send the
|
||||
associated response string. Note that you should put newlines in your
|
||||
@ -1517,7 +1505,6 @@ class spawn_unix (object):
|
||||
window size to change when the parent's window size changes then do
|
||||
something like the following example::
|
||||
|
||||
import pexpect, struct, fcntl, termios, signal, sys
|
||||
def sigwinch_passthrough (sig, data):
|
||||
s = struct.pack("HHHH", 0, 0, 0, 0)
|
||||
a = struct.unpack('hhhh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ , s))
|
||||
@ -2942,3 +2929,6 @@ def split_command_line(command_line):
|
||||
arg_list.append(arg)
|
||||
return arg_list
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user