[llvm-dev] Migrate utils/ Python 2 scripts to Python 3
Fāng-ruì Sòng via llvm-dev
llvm-dev at lists.llvm.org
Mon Jan 29 12:46:42 PST 2018
Hi LLVM-Devs,
I noticed that many Python scripts under utils/ have a shebang of
`#!/usr/bin/python` (which is a symlink to python2.7 on many platforms) and some of them use Python 2 syntax that is not compatible with Python 3 (e.g. print statements; str/bytes)
I created a revision to migrate utils/update_{llc_,}_test_checks.py from Python 2 to Python 3 https://reviews.llvm.org/D42450 , the arguments against making it Python 3 is:
* There are many Mac OS X users and Mac OS X 10.8 comes with Python 2.7 pre-installed [0] but not Python 3.
* Forcing scripts to use Python 3 (by doing so we can avoid some compatibility trouble) may not be a good idea.
Python 2.7 was published in 2010 and planned as the last of the 2.x releases. It will not be maintained past 2020 and there is also a retirement page https://pythonclock.org/ .
The second argument would not need to be addressed if the first one did not lay too much burden on developers. After all, we have to install `cmake, ninja/GNU Make / libedit(for lldb)` to build LLVM. These packages are not installed by default on many platforms.
Thoughts on deprecating Python 2 for utils/ scripts (different from libclang or lldb scripts) which are not user-facing?
[0]: https://docs.python.org/3/using/mac.html#getting-and-installing-macpython
Thanks,
Fangrui
More information about the llvm-dev
mailing list