Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TIOCGWINSZ to get the terminal size #254

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Conversation

klange
Copy link

@klange klange commented May 13, 2017

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.

@maandree
Copy link
Collaborator

os.get_terminal_size() is even better.

@klange
Copy link
Author

klange commented May 13, 2017

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().

@maandree
Copy link
Collaborator

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.

@JotaRandom
Copy link
Collaborator

JotaRandom commented May 14, 2017

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.

@JotaRandom
Copy link
Collaborator

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?

@JotaRandom
Copy link
Collaborator

JotaRandom commented Aug 28, 2019

  • 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

@klange
Copy link
Author

klange commented Sep 6, 2019

ToaruOS/PonyOS ship packages for Python 3.6, so no problem from our end.

@HaleTom
Copy link

HaleTom commented Jul 27, 2020

What is still needed for this PR to be merged in?

@JotaRandom
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants