ponysay
ponysay copied to clipboard
Use TIOCGWINSZ to get the terminal size
This patch is derived from the port of ponysay to PonyOS, where stty
was ported from Minix and does not have the size
option. This approach should be faster and more widely portable and has been tested on Linux, OS X, and of course PonyOS.
os.get_terminal_size()
is even better.
os.get_terminal_size()
is only available in Python 3.3 and newer; if that's an acceptable requirement, shutil.get_terminal_size
may be a better option as it also checks the $COLUMNS
and $LINES
environment variables before calling os.get_terminal_size()
.
3.3 should be fine I don't think anyone is till one 3.2−. I don't think checking $COLUMNS
and $LINES
is worth while. TIOCGWINSZ
over stdout (which is the only thing os.get_terminal_size
does) should be enough.
However, maybe there are programs that expect the current behaviour, so perhaps, your patch is the best option, but with one change: try, stderr first, then stdout, and stdin last.
I'm ok, all go for fallbacks.
Also I think we should stick to our minimal python 3.2
I think unless we want start finishing to-dos for ponysay 3.1
, so we can raise it for ponysay 3.1
Q: What's Toaruos' max compilable python version?? Q: What's Toaruos' shipped python version??
EDIT: I did a long search and I come to this
- Ubuntu 14.04 (march 2019)have Python 3.4.0
- Debian 8 (I dont know) have Python 3.4.2 - Debian 7/Devuan 1 have Python 3.2.3
- SUSE Linux Enterprise 12 SP1 have Python 2.7.9 but can't find info on Python 3
- OpenSuse aparently is Python 3.4.0 but opensuse page was 504 at the time of consulting
- Fedora 23 have python 3.4 2
- RedHat 7 have Python 3.3.2 but RH 6 dont ship Python 3 (and therefor Centos apply all here) .
- OSX 10.10 server officialy contain python 2.7.10 and aparently Python 3.4.0 is also installed.
So in resume is 3.3.2
the minimum if we want support as much as we want and 3.4.0
if we don't care about Debian 7/Devuan 1.
I did a release but it keep the same old minimal version so i think now is the time to decide if up the minimal python version or not for 3.0.4
Your throughs?
- SUSE Linux Enterprise 12 SP3 have python 3.4 if they repos are right
- RedHat 7 and CentOS 7 have python 3.3, 3.4, 3.5, 3.6 available to be installed as far as I can look into the repos
- RedHat 8 and CentOS 8 have python 3.6 is the default
So I will asume that ToaruOS can compile and use python 3.4, so is safe to bump the minimal to 3.4
ToaruOS/PonyOS ship packages for Python 3.6, so no problem from our end.
What is still needed for this PR to be merged in?
What is still needed for this PR to be merged in?
Well as was discused it need a backup method, i think that every distro and system is capable or is already runing the minimum version but what if the TIOCGWINSZ method fail, there is a backup method to get the stuff?
So make the TIOCGWINSZ method and fall back to the actual if something went wrong; update the CHANGELOG and TEXINFO page acordingly too and will be enoigh for me