OLD | NEW |
(Empty) | |
| 1 History |
| 2 ======= |
| 3 |
| 4 Releases |
| 5 -------- |
| 6 |
| 7 Version 4.0 |
| 8 ``````````` |
| 9 |
| 10 * Integration with :mod:`asyncio`: passing ``async=True`` to :meth:`~.spawn.expe
ct`, |
| 11 :meth:`~.spawn.expect_exact` or :meth:`~.spawn.expect_list` will make them ret
urn a |
| 12 coroutine. You can get the result using ``yield from``, or wrap it in an |
| 13 :class:`asyncio.Task`. This allows the event loop to do other things while |
| 14 waiting for output that matches a pattern. |
| 15 * Experimental support for Windows (with some caveats)—see :ref:`windows`. |
| 16 * Enhancement: allow method as callbacks of argument ``events`` for |
| 17 :func:`pexpect.run` (:ghissue:`176`). |
| 18 * It is now possible to call :meth:`~.spawn.wait` multiple times, or after a pro
cess |
| 19 is already determined to be terminated without raising an exception |
| 20 (:ghpull:`211`). |
| 21 * New :class:`pexpect.spawn` keyword argument, ``dimensions=(rows, columns)`` |
| 22 allows setting terminal screen dimensions before launching a program |
| 23 (:ghissue:`122`). |
| 24 * Fix regression that prevented executable, but unreadable files from |
| 25 being found when not specified by absolute path -- such as |
| 26 /usr/bin/sudo (:ghissue:`104`). |
| 27 * Fixed regression when executing pexpect with some prior releases of |
| 28 the multiprocessing module where stdin has been closed (:ghissue:`86`). |
| 29 |
| 30 Backwards incompatible changes |
| 31 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 32 |
| 33 * Deprecated ``pexpect.screen`` and ``pexpect.ANSI``. Please use other packages |
| 34 such as `pyte <https://pypi.python.org/pypi/pyte>`__ to emulate a terminal. |
| 35 * Removed the independent top-level modules (``pxssh fdpexpect FSM screen ANSI``
) |
| 36 which were installed alongside Pexpect. These were moved into the Pexpect |
| 37 package in 3.0, but the old names were left as aliases. |
| 38 * Child processes created by Pexpect no longer ignore SIGHUP by default: the |
| 39 ``ignore_sighup`` parameter of :class:`pexpect.spawn` defaults to False. To |
| 40 get the old behaviour, pass ``ignore_sighup=True``. |
| 41 |
| 42 Version 3.3 |
| 43 ``````````` |
| 44 |
| 45 * Added a mechanism to wrap REPLs, or shells, in an object which can convenientl
y |
| 46 be used to send commands and wait for the output (:mod:`pexpect.replwrap`). |
| 47 * Fixed issue where pexpect would attempt to execute a directory because |
| 48 it has the 'execute' bit set (:ghissue:`37`). |
| 49 * Removed the ``pexpect.psh`` module. This was never documented, and we found |
| 50 no evidence that people use it. The new :mod:`pexpect.replwrap` module |
| 51 provides a more flexible alternative. |
| 52 * Fixed ``TypeError: got <type 'str'> ('\r\n') as pattern`` in :meth:`spawnu.rea
dline` |
| 53 method (:ghissue:`67`). |
| 54 * Fixed issue where EOF was not correctly detected in :meth:`~.interact`, causin
g |
| 55 a repeating loop of output on Linux, and blocking before EOF on BSD and |
| 56 Solaris (:ghissue:`49`). |
| 57 * Several Solaris (SmartOS) bugfixes, preventing :exc:`IOError` exceptions, espe
cially |
| 58 when used with cron(1) (:ghissue:`44`). |
| 59 * Added new keyword argument ``echo=True`` for :class:`spawn`. On SVR4-like |
| 60 systems, the method :meth:`~.isatty` will always return *False*: the child pty |
| 61 does not appear as a terminal. Therefore, :meth:`~.setecho`, :meth:`~.getwins
ize`, |
| 62 :meth:`~.setwinsize`, and :meth:`~.waitnoecho` are not supported on those plat
forms. |
| 63 |
| 64 After this, we intend to start working on a bigger refactoring of the code, to |
| 65 be released as Pexpect 4. There may be more bugfix 3.x releases, however. |
| 66 |
| 67 Version 3.2 |
| 68 ``````````` |
| 69 |
| 70 * Fix exception handling from :func:`select.select` on Python 2 (:ghpull:`38`). |
| 71 This was accidentally broken in the previous release when it was fixed for |
| 72 Python 3. |
| 73 * Removed a workaround for ``TIOCSWINSZ`` on very old systems, which was causing |
| 74 issues on some BSD systems (:ghpull:`40`). |
| 75 * Fixed an issue with exception handling in :mod:`~pexpect.pxssh` (:ghpull:`43`) |
| 76 |
| 77 The documentation for :mod:`~pexpect.pxssh` was improved. |
| 78 |
| 79 Version 3.1 |
| 80 ``````````` |
| 81 |
| 82 * Fix an issue that prevented importing pexpect on Python 3 when ``sys.stdout`` |
| 83 was reassigned (:ghissue:`30`). |
| 84 * Improve prompt synchronisation in :mod:`~pexpect.pxssh` (:ghpull:`28`). |
| 85 * Fix pickling exception instances (:ghpull:`34`). |
| 86 * Fix handling exceptions from :func:`select.select` on Python 3 (:ghpull:`33`). |
| 87 |
| 88 The examples have also been cleaned up somewhat - this will continue in future |
| 89 releases. |
| 90 |
| 91 Version 3.0 |
| 92 ``````````` |
| 93 |
| 94 The new major version number doesn't indicate any deliberate API incompatibility
. |
| 95 We have endeavoured to avoid breaking existing APIs. However, pexpect is under |
| 96 new maintenance after a long dormancy, so some caution is warranted. |
| 97 |
| 98 * A new :ref:`unicode API <unicode>` was introduced. |
| 99 * Python 3 is now supported, using a single codebase. |
| 100 * Pexpect now requires at least Python 2.6 or 3.2. |
| 101 * The modules other than pexpect, such as :mod:`pexpect.fdpexpect` and |
| 102 :mod:`pexpect.pxssh`, were moved into the pexpect package. For now, wrapper |
| 103 modules are installed to the old locations for backwards compatibility (e.g. |
| 104 ``import pxssh`` will still work), but these will be removed at some point in |
| 105 the future. |
| 106 * Ignoring ``SIGHUP`` is now optional - thanks to Kimmo Parviainen-Jalanko for |
| 107 the patch. |
| 108 |
| 109 We also now have `docs on ReadTheDocs <http://pexpect.readthedocs.org/>`_, |
| 110 and `continuous integration on Travis CI <https://travis-ci.org/pexpect/pexpect>
`_. |
| 111 |
| 112 Version 2.4 |
| 113 ``````````` |
| 114 |
| 115 * Fix a bug regarding making the pty the controlling terminal when the process |
| 116 spawning it is not, actually, a terminal (such as from cron) |
| 117 |
| 118 Version 2.3 |
| 119 ``````````` |
| 120 |
| 121 * Fixed OSError exception when a pexpect object is cleaned up. Previously, you |
| 122 might have seen this exception:: |
| 123 |
| 124 Exception exceptions.OSError: (10, 'No child processes') |
| 125 in <bound method spawn.__del__ of <pexpect.spawn instance at 0xd248c>> ign
ored |
| 126 |
| 127 You should not see that anymore. Thanks to Michael Surette. |
| 128 * Added support for buffering reads. This greatly improves speed when trying to |
| 129 match long output from a child process. When you create an instance of the spa
wn |
| 130 object you can then set a buffer size. For now you MUST do the following to tu
rn |
| 131 on buffering -- it may be on by default in future version:: |
| 132 |
| 133 child = pexpect.spawn ('my_command') |
| 134 child.maxread=1000 # Sets buffer to 1000 characters. |
| 135 |
| 136 * I made a subtle change to the way TIMEOUT and EOF exceptions behave. |
| 137 Previously you could either expect these states in which case pexpect |
| 138 will not raise an exception, or you could just let pexpect raise an |
| 139 exception when these states were encountered. If you expected the |
| 140 states then the ``before`` property was set to everything before the |
| 141 state was encountered, but if you let pexpect raise the exception then |
| 142 ``before`` was not set. Now, the ``before`` property will get set either |
| 143 way you choose to handle these states. |
| 144 * The spawn object now provides iterators for a *file-like interface*. |
| 145 This makes Pexpect a more complete file-like object. You can now write |
| 146 code like this:: |
| 147 |
| 148 child = pexpect.spawn ('ls -l') |
| 149 for line in child: |
| 150 print line |
| 151 |
| 152 * write and writelines() no longer return a value. Use send() if you need that |
| 153 functionality. I did this to make the Spawn object more closely match a |
| 154 file-like object. |
| 155 * Added the attribute ``exitstatus``. This will give the exit code returned |
| 156 by the child process. This will be set to ``None`` while the child is still |
| 157 alive. When ``isalive()`` returns 0 then ``exitstatus`` will be set. |
| 158 * Made a few more tweaks to ``isalive()`` so that it will operate more |
| 159 consistently on different platforms. Solaris is the most difficult to support. |
| 160 * You can now put ``TIMEOUT`` in a list of expected patterns. This is just like |
| 161 putting ``EOF`` in the pattern list. Expecting for a ``TIMEOUT`` may not be |
| 162 used as often as ``EOF``, but this makes Pexpect more consistent. |
| 163 * Thanks to a suggestion and sample code from Chad J. Schroeder I added the abil
ity |
| 164 for Pexpect to operate on a file descriptor that is already open. This means t
hat |
| 165 Pexpect can be used to control streams such as those from serial port devices.
Now, |
| 166 you just pass the integer file descriptor as the "command" when constructing a |
| 167 spawn open. For example on a Linux box with a modem on ttyS1:: |
| 168 |
| 169 fd = os.open("/dev/ttyS1", os.O_RDWR|os.O_NONBLOCK|os.O_NOCTTY) |
| 170 m = pexpect.spawn(fd) # Note integer fd is used instead of usual string. |
| 171 m.send("+++") # Escape sequence |
| 172 m.send("ATZ0\r") # Reset modem to profile 0 |
| 173 rval = m.expect(["OK", "ERROR"]) |
| 174 |
| 175 * ``read()`` was renamed to ``read_nonblocking()``. Added new ``read()`` method |
| 176 that matches file-like object interface. In general, you should not notice |
| 177 the difference except that ``read()`` no longer allows you to directly set the |
| 178 timeout value. I hope this will not effect any existing code. Switching to |
| 179 ``read_nonblocking()`` should fix existing code. |
| 180 * Changed the name of ``set_echo()`` to ``setecho()``. |
| 181 * Changed the name of ``send_eof()`` to ``sendeof()``. |
| 182 * Modified ``kill()`` so that it checks to make sure the pid ``isalive()``. |
| 183 * modified ``spawn()`` (really called from ``__spawn()``) so that it does not |
| 184 raise an expection if ``setwinsize()`` fails. Some platforms such as Cygwin |
| 185 do not like setwinsize. This was a constant problem and since it is not a |
| 186 critical feature I decided to just silence the error. Normally I don't like |
| 187 to do that, but in this case I'm making an exception. |
| 188 * Added a method ``close()`` that does what you think. It closes the file |
| 189 descriptor of the child application. It makes no attempt to actually kill the |
| 190 child or wait for its status. |
| 191 * Add variables ``__version__`` and ``__revision__`` (from cvs) to the pexpect |
| 192 modules. This is mainly helpful to me so that I can make sure that I'm testin
g |
| 193 with the right version instead of one already installed. |
| 194 * ``log_open()`` and ``log_close(`` have been removed. Now use ``setlog()``. |
| 195 The ``setlog()`` method takes a file object. This is far more flexible than |
| 196 the previous log method. Each time data is written to the file object it will |
| 197 be flushed. To turn logging off simply call ``setlog()`` with None. |
| 198 * renamed the ``isAlive()`` method to ``isalive()`` to match the more typical |
| 199 naming style in Python. Also the technique used to detect child process |
| 200 status has been drastically modified. Previously I did some funky stuff |
| 201 with signals which caused indigestion in other Python modules on some |
| 202 platforms. It was a big headache. It still is, but I think it works |
| 203 better now. |
| 204 * attribute ``matched`` renamed to ``after`` |
| 205 * new attribute ``match`` |
| 206 * The ``expect_eof()`` method is gone. You can now simply use the |
| 207 ``expect()`` method to look for EOF. |
| 208 * **Pexpect works on OS X**, but the nature of the quirks cause many of the |
| 209 tests to fail. See bugs. (Incomplete Child Output). The problem is more |
| 210 than minor, but Pexpect is still more than useful for most tasks. |
| 211 * **Solaris**: For some reason, the *second* time a pty file descriptor is creat
ed and |
| 212 deleted it never gets returned for use. It does not effect the first time |
| 213 or the third time or any time after that. It's only the second time. This |
| 214 is weird... This could be a file descriptor leak, or it could be some |
| 215 peculiarity of how Solaris recycles them. I thought it was a UNIX requirement |
| 216 for the OS to give you the lowest available filedescriptor number. In any case
, |
| 217 this should not be a problem unless you create hundreds of pexpect instances..
. |
| 218 It may also be a pty module bug. |
| 219 |
| 220 |
| 221 Moves and forks |
| 222 --------------- |
| 223 |
| 224 * Pexpect development used to be hosted on Sourceforge. |
| 225 * In 2011, Thomas Kluyver forked pexpect as 'pexpect-u', to support |
| 226 Python 3. He later decided he had taken the wrong approach with this. |
| 227 * In 2012, Noah Spurrier, the original author of Pexpect, moved the |
| 228 project to Github, but was still too busy to develop it much. |
| 229 * In 2013, Thomas Kluyver and Jeff Quast forked Pexpect again, intending |
| 230 to call the new fork Pexpected. Noah Spurrier agreed to let them use |
| 231 the name Pexpect, so Pexpect versions 3 and above are based on this |
| 232 fork, which now lives `here on Github <https://github.com/pexpect/pexpect>`_. |
| 233 |
OLD | NEW |