Message149629
| Author |
zbysz |
| Recipients |
denilsonsa, giampaolo.rodola, pitrou, zbysz |
| Date |
2011年12月16日.16:09:27 |
| SpamBayes Score |
2.3996405e-08 |
| Marked as misclassified |
No |
| Message-id |
<1324051770.7.0.389687767252.issue13609@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
This is proof-of-concept implementation.
This adds two modules: termsize (python) and _termsize (C). The first one contains the get_terminal_size user-facing function and namedtuple definition. The second on contains the function query_terminal_size which does the real job.
Two simple tests are added. I'm not sure if it is feasible to test with different terminal sizes: it certainly _could_ be done, e.g. by launching an xterm with a specified geometry, but this would be much
more complicated than this implementation, so probably not worth it.
This was only tested on 64-bit linux, seems to work.
I'm not sure how to the configure tests should be done: right now the presence of <sys/ioctl.h> is checked, and it is used. If not available,
<conio.h> is checked, and used. Otherwise NotImplementedError is thrown.
Would be nice to test on a mac and other systems, but I don't have one available at the moment unfortunately.
I think that the python part (termsize.py) should be either merged with os.py (or whatever home we find for this function), or rewritten in C in _termsizemodule.c and only imported into os. But since it hasn't yet been decided where this should go, keeping it separate is easier for now. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年12月16日 16:09:31 | zbysz | set | recipients:
+ zbysz, pitrou, giampaolo.rodola, denilsonsa |
| 2011年12月16日 16:09:30 | zbysz | set | messageid: <1324051770.7.0.389687767252.issue13609@psf.upfronthosting.co.za> |
| 2011年12月16日 16:09:28 | zbysz | link | issue13609 messages |
| 2011年12月16日 16:09:28 | zbysz | create |
|