summaryrefslogtreecommitdiffstats
path: root/make/configure.py
diff options
context:
space:
mode:
authorFrederick Ding <[email protected]>2019-02-27 22:09:24 +0000
committerJohn Stebbins <[email protected]>2019-02-28 06:25:07 -0800
commit22ee1a38eac473ce81d487f88ca58382abbaa0cb (patch)
treef6a7930c666b39c5b1776609a83d41e4d74ee50b /make/configure.py
parentf60354ef7ece3c69a0c6e83021778c28270b2880 (diff)
Fix Py3 compat and logic/syntax in handling version.txt
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.
Diffstat (limited to 'make/configure.py')
-rw-r--r--make/configure.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/make/configure.py b/make/configure.py
index 64e12556c..f132b9ec4 100644
--- a/make/configure.py
+++ b/make/configure.py
@@ -718,7 +718,8 @@ class RepoProbe( ShellProbe ):
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 )
@@ -785,7 +786,7 @@ class RepoProbe( ShellProbe ):
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' )