Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/28309 )

Change subject: python: Fix compareVersions for python 3.
......................................................................

python: Fix compareVersions for python 3.

When the internal utility function make_version_list sees a string, it
tries to convert it into a list using the map() function. In python 3,
that returns an iterator. The following call to zip() will consume those
iterators, and then the following calls to len() will die because they
don't work on map iterators.

This is only a problem if all the common components of the version lists
are equal, and the comparison needs to then check if one of the lists
was equal to the other but with more components. When versions are
equal, for instance when compiling with the oldest supported version of
gcc (4.8.0) this error surfaces and breaks our scons build.

A simple fix is to just wrap the call to map() with list() to convert
the iterator to a flat list, making the other logic work as before.

Change-Id: If9dc5cd7fff70c21229ac3dd9a017edeccd26148
---
M src/python/m5/util/__init__.py
1 file changed, 2 insertions(+), 1 deletion(-)



diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py
index fd1ea91..98a7a08 100644
--- a/src/python/m5/util/__init__.py
+++ b/src/python/m5/util/__init__.py
@@ -125,7 +125,8 @@
         if isinstance(v, (list,tuple)):
             return v
         elif isinstance(v, string_types):
- return map(lambda x: int(re.match('\d+', x).group()), v.split('.'))
+            return list(map(lambda x: int(re.match('\d+', x).group()),
+                            v.split('.')))
         else:
             raise TypeError()


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/28309
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If9dc5cd7fff70c21229ac3dd9a017edeccd26148
Gerrit-Change-Number: 28309
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to