kristovatlas / osx-config-check

Verify the configuration of your OS X machine.
MIT License
1.25k stars 111 forks source link

python3 support #192

Closed akerl closed 2 years ago

akerl commented 7 years ago

This is based on #90 but accounts for more recent changes

xiaopeng163 commented 6 years ago

There are some code lines need to be fixed, like the print statement. If you just use print as a function, then the code does not support python2.

One solution is put from __future__ import print_function at the beginning of the file where we use print as a function.

the other changed parts also must consider the compatibility of python 2 and 3.

eirnym commented 6 years ago

@xiaopeng163 it's not true. Both python 2.7.15 and sytem python 2.7.10 will print a line with letters Hello world for an one-line program below

print("Hello world")
xiaopeng163 commented 6 years ago

@eirnym yes, but if we want to say python 2 support, we may not only support python 2,7 +

eirnym commented 6 years ago

(you have no lines with syntax should be changed, so 2.6 could be used as a minimum requirement)

There's a few points to notice:

BTW, I don't know which python less than 2.6 you really want to support in 2018 as I don't know a system where you are not able to run at least Python 2.6.
With print() in worst case will end up with messages in brackets, like (printed message), with upgrading this line with deprecated syntax will break compatibility with python 2.3 or even less. Finally, patching will not break anything. I don't believe that this script would run on Python 2.2 or less due to dependencies you use.