# HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel <hol...@merlinux.eu> # Date 1280142790 -7200 # Node ID 4e54c87c51398260acd559ce8aabf2183ed79552 # Parent d70d85a54bb0c3965b2f6c3071e213af83bf0aa0 fix terminal dimension detection to work with stdout
--- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def main(): name='py', description='py.test and pylib: rapid testing and development utils.', long_description = long_description, - version= '1.3.2', + version= '1.3.3a1', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], --- a/py/__init__.py +++ b/py/__init__.py @@ -8,7 +8,7 @@ dictionary or an import path. (c) Holger Krekel and others, 2004-2010 """ -__version__ = version = "1.3.2" +__version__ = version = "1.3.3a1" import py.apipkg --- a/testing/io_/test_terminalwriter.py +++ b/testing/io_/test_terminalwriter.py @@ -6,6 +6,18 @@ def test_get_terminal_width(): x = py.io.get_terminal_width assert x == terminalwriter.get_terminal_width +def test_getdimensions(monkeypatch): + fcntl = py.test.importorskip("fcntl") + import struct + l = [] + monkeypatch.setattr(fcntl, 'ioctl', lambda *args: l.append(args)) + try: + terminalwriter._getdimensions() + except struct.error: + pass + assert len(l) == 1 + assert l[0][0] == 1 + def test_terminal_width_COLUMNS(monkeypatch): """ Dummy test for get_terminal_width """ --- a/py/_io/terminalwriter.py +++ b/py/_io/terminalwriter.py @@ -18,7 +18,7 @@ if sys.platform == "win32": def _getdimensions(): import termios,fcntl,struct - call = fcntl.ioctl(0,termios.TIOCGWINSZ,"\000"*8) + call = fcntl.ioctl(1,termios.TIOCGWINSZ,"\000"*8) height,width = struct.unpack( "hhhh", call ) [:2] return height, width --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +Changes between 1.3.2 and 1.3.3a1 +================================================== + +- fix weirdness: make terminal width detection work on stdout instead of stdin + (thanks Armin Ronacher for reporting) + Changes between 1.3.1 and 1.3.2 ================================================== _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn