[U-Boot] [PATCHv2 06/13] test/py: Manual python3 fixes

Stephen Warren swarren at wwwdotorg.org
Wed Oct 23 19:27:15 UTC 2019


On 10/23/19 1:01 PM, Tom Rini wrote:
> On Wed, Oct 23, 2019 at 12:50:12PM -0600, Stephen Warren wrote:
>> On 10/22/19 9:20 PM, Tom Rini wrote:
>>> - Modern pytest is more visible in telling us about parameters that we
>>>     had not described, so describe a few more.
>>> - ConfigParser.readfp(...) is now configparser.read_file(...)
>>> - As part of the "strings vs bytes" conversions in Python 3, we use the
>>>     default encoding/decoding of utf-8 but in some places tell Python to
>>>     replace problematic conversions rather than throw a fatal error.
>>> - Fix a typo noticed while doing the above ("tot he" -> "to the").
>>> - As suggested by Stephen, re-alphabetize the import list
>>> - Per Heinrich, replace how we write contents in test_fit.py
>>
>>> diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py
>>
>>> @@ -133,7 +134,7 @@ class RunAndLog(object):
>>>            self.logfile.write(self, msg)
>>>            try:
>>> -            p = subprocess.Popen(cmd, cwd=cwd,
>>> +            p = subprocess.Popen(cmd, cwd=cwd, encoding="utf-8",
>>
>> The encoding parameter was added in Python 3.6, so this change causes
>> test.py to crash for me (with Python 3.5.2). The following will fix that:
> 
> Right, Ubuntu 16.04 has Python 3.5.x and later has 3.6 or higher.  It's
> reasonable to ask what the minimum host version is going to be and how
> much overhead things get the lower we go.  Given:
> 
>>>              p = subprocess.Popen(cmd, cwd=cwd,
>>>                  stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
>>>              (stdout, stderr) = p.communicate()
>>>              if stdout is not None:
>>>                  stdout = stdout.decode('utf-8')
>>>              if stderr is not None:
>>>                  stderr = stderr.decode('utf-8')
> 
> That's not too bad, so we can go with that.  Can you please chime in on
> the "Minimum Python 3 version?" thread with what I assume is your
> use-case of needing to use older-than-latest-LTS distributions?

A very quick survey of distros that I can quickly find package lists for:

RHEL 6 - 2 only
RHEL 7 - 3.6
Ubuntu 16.04 - 3.5
Ubuntu 18.04 - 3.6
Debian oldtsable - 3.5
Debian stable and all later - 3.7

So, Ubuntu 16.04 is perhaps the only distro that still contains Python 
3.5. That said, 16.04 is still fully supported for 18 more months, so it 
feels quite reasonable to support it. I have no choice but to use it for 
now.


More information about the U-Boot mailing list