[SDKs] Add Python version test 2.7 <= sys.version_info < 3
<tetron> brett: regarding #5136 any thoughts on how to warn the user if they are using Python < 2.7 ?
<brett> tetron: Inspect sys.version_info.
<tetron> so in arvados/__init__.py we should put a test at the top
<brett> Have arvados/__init__.py raise an ImportError or something. Don't see much point warning when it's never going to work.
<tetron> and bail out if sys.version_info isn't 2.7 or greater
<tetron> I'll add a ticket to bug triage
<brett> We should just check that major and minor are exactly 2.7.
<brett> It's not going to work under Python 3 either.
<brett> Well, I guess for total correctness check 2.7 <= v < 3.0.
<tetron> I was thinking more about a hypothetical Python 2.8
<brett> It's never going to happen but sure.
<tetron> brett: #5137
#3 Updated by Brett Smith over 4 years ago
In order for the proposal to work, the old version of Python has to be able to compile and run
arvados/__init__.py up through where the check is. Otherwise, users will get some kind of SyntaxError instead. The syntax currently in that file is pretty conservative, but the more conservative we make it, the better. The ternary operator and context managers ("with" statements) were added in Python 2.5. Syntax newer than that includes set literals and dictionary comprehensions.
At a first glance, I think we could make this file compile in all of Python 2.x if we flattened the ternary operator in logging setup.