summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/api/ANSI.rst14
-rw-r--r--doc/api/index.rst9
-rw-r--r--doc/api/pexpect.rst32
-rw-r--r--doc/api/screen.rst10
-rw-r--r--doc/history.rst8
-rw-r--r--doc/overview.rst2
6 files changed, 34 insertions, 41 deletions
diff --git a/doc/api/ANSI.rst b/doc/api/ANSI.rst
deleted file mode 100644
index 064563d..0000000
--- a/doc/api/ANSI.rst
+++ /dev/null
@@ -1,14 +0,0 @@
-ANSI - ANSI (VT100) terminal emulator
-=====================================
-
-.. automodule:: pexpect.ANSI
-
-.. autoclass:: term
- :show-inheritance:
-
-.. autoclass:: ANSI
- :show-inheritance:
-
- .. automethod:: write_ch
- .. automethod:: write
- .. automethod:: process \ No newline at end of file
diff --git a/doc/api/index.rst b/doc/api/index.rst
index 1a6a6ae..fd017a5 100644
--- a/doc/api/index.rst
+++ b/doc/api/index.rst
@@ -8,5 +8,10 @@ API documentation
fdpexpect
replwrap
pxssh
- screen
- ANSI
+
+The modules ``pexpect.screen`` and ``pexpect.ANSI`` have been deprecated in
+Pexpect version 4. They were separate from the main use cases for Pexpect, and
+there are better maintained Python terminal emulator packages, such as
+`pyte <https://pypi.python.org/pypi/pyte>`__.
+These modules are still present for now, but we don't advise using them in new
+code.
diff --git a/doc/api/pexpect.rst b/doc/api/pexpect.rst
index 565f0ef..79bbcef 100644
--- a/doc/api/pexpect.rst
+++ b/doc/api/pexpect.rst
@@ -36,9 +36,9 @@ spawn class
.. note::
- With a :class:`spawn` instance, the log files should be open for
- writing binary data. With a :class:`spawnu` instance, they should
- be open for writing unicode text.
+ With :class:`spawn` in bytes mode, the log files should be open for
+ writing binary data. In unicode mode, they should
+ be open for writing unicode text. See :ref:`unicode`.
Controlling the child process
`````````````````````````````
@@ -69,31 +69,35 @@ Controlling the child process
Handling unicode
````````````````
-For backwards compatibility, :class:`spawn` can handle some Unicode: its
-send methods will encode arbitrary unicode as UTF-8 before sending it to the
-child process, and its expect methods can accept ascii-only unicode strings.
-However, for a proper unicode API to a subprocess, use this subclass:
+By default, :class:`spawn` is a bytes interface: its read methods return bytes,
+and its write/send and expect methods expect bytes. If you pass the *encoding*
+parameter to the constructor, it will instead act as a unicode interface:
+strings you send will be encoded using that encoding, and bytes received will
+be decoded before returning them to you. In this mode, patterns for
+:meth:`~spawn.expect` and :meth:`~spawn.expect_exact` should also be unicode.
+
+.. versionchanged:: 4.0
-.. autoclass:: spawnu
- :show-inheritance:
+ :class:`spawn` provides both the bytes and unicode interfaces. In Pexpect
+ 3.x, the unicode interface was provided by a separate ``spawnu`` class.
-There is also a :func:`runu` function, the unicode counterpart to :func:`run`.
+For backwards compatibility, some Unicode is allowed in bytes mode: the
+send methods will encode arbitrary unicode as UTF-8 before sending it to the
+child process, and its expect methods can accept ascii-only unicode strings.
.. note::
Unicode handling with pexpect works the same way on Python 2 and 3, despite
the difference in names. I.e.:
- - :class:`spawn` works with ``str`` on Python 2, and :class:`bytes` on Python 3,
- - :class:`spawnu` works with ``unicode`` on Python 2, and :class:`str` on Python 3.
+ - Bytes mode works with ``str`` on Python 2, and :class:`bytes` on Python 3,
+ - Unicode mode works with ``unicode`` on Python 2, and :class:`str` on Python 3.
run function
------------
.. autofunction:: run
-.. autofunction:: runu
-
Exceptions
----------
diff --git a/doc/api/screen.rst b/doc/api/screen.rst
deleted file mode 100644
index 8268fb9..0000000
--- a/doc/api/screen.rst
+++ /dev/null
@@ -1,10 +0,0 @@
-screen - manage a virtual 'screen'
-==================================
-
-.. automodule:: pexpect.screen
-
-.. autoclass:: screen
- :members:
-
- .. automethod:: __init__
- .. automethod:: __str__ \ No newline at end of file
diff --git a/doc/history.rst b/doc/history.rst
index 95bf371..8186b47 100644
--- a/doc/history.rst
+++ b/doc/history.rst
@@ -14,6 +14,14 @@ Version 4.0
waiting for output that matches a pattern.
* Enhancement: allow method as callbacks of argument ``events`` for
:func:`pexpect.run` (:ghissue:`176`).
+* It is now possible to call :meth:`~.wait` multiple times, or after a process
+ is already determined to be terminated without raising an exception
+ (:ghpull:`211`).
+* Deprecated ``pexpect.screen`` and ``pexpect.ANSI``. Please use other packages
+ such as `pyte <https://pypi.python.org/pypi/pyte>`__ to emulate a terminal.
+* Removed the independent top-level modules (``pxssh fdpexpect FSM screen ANSI``)
+ which were installed alongside Pexpect. These were moved into the Pexpect
+ package in 3.0, but the old names were left as aliases.
Version 3.4
```````````
diff --git a/doc/overview.rst b/doc/overview.rst
index 76fc846..139ba36 100644
--- a/doc/overview.rst
+++ b/doc/overview.rst
@@ -60,7 +60,7 @@ Special EOF and TIMEOUT patterns
--------------------------------
There are two special patterns to match the End Of File (:class:`~pexpect.EOF`)
-or a Timeout condition (:class:`~pexpect.TIMEOUT`). You you can pass these
+or a Timeout condition (:class:`~pexpect.TIMEOUT`). You can pass these
patterns to :meth:`~pexpect.spawn.expect`. These patterns are not regular
expressions. Use them like predefined constants.