The first fix addresses the problem that readlines() gives back a
list of strings, which do not have the `.decode()` method that bytes do.
But `_parseSession()` is used both for the bytes output by running
`repo-info.sh` and for the strings output by ingesting `version.txt`.
So we still need to handle the bytes case.
The second fix addresses syntax and logic problems. If a string is
not empty, `if self.hash` will check that it's non-empty (I don't think
`is not empty` actually works -- it has given me a NameError). And the
string comparison should be done by value equality, not reference
equality.
def _parseSession( self ):
for line in self.session:
- line = line.decode('utf-8')
+ if isinstance(line, bytes):
+ line = line.decode('utf-8')
## grok fields
m = re.match( '([^\=]+)\=(.*)', line )
self.session = in_file.readlines()
if self.session:
self._parseSession()
- if self.hash is not empty and self.hash is not 'deadbeaf':
+ if self.hash and self.hash != 'deadbeaf':
cfg.infof( '(pass)\n' )
else:
cfg.infof( '(fail)\n' )