Bug 1362142 - Mozharness to distinguish Windows archictecture properly. r=aki draft
authorArmen Zambrano G. <armenzg@mozilla.com>
Thu, 04 May 2017 15:16:50 -0400
changeset 572766 729f581dfa8244e3055cc0c383760444850ccdfa
parent 572730 0b255199db9d6a6f189b89b7906f99155bde3726
child 627129 55c1ce0cd3d293a9f4bf9601681cd87b16dc6d96
push id57188
push userarmenzg@mozilla.com
push dateThu, 04 May 2017 19:18:29 +0000
reviewersaki
bugs1362142
milestone55.0a1
Bug 1362142 - Mozharness to distinguish Windows archictecture properly. r=aki We currently use: > '64' in platform.architecture()[0] # architecture() returns (bits, linkage) Unfortunately, that is the Python binary byte size. https://docs.python.org/2/library/platform.html > platform.architecture(executable=sys.executable, bits='', linkage='') > > Queries the given executable (defaults to the Python interpreter binary) > for various architecture information. > > Returns a tuple (bits, linkage) which contain information about the bit > architecture and the linkage format used for the executable. Instead we should be using machine() > platform.machine() > > Returns the machine type, e.g. 'i386'. An empty string is returned if the > value cannot be determined. My sampling size: * win10 - AMD64 * win7 - x86 * Linux64 - x86_64 * MacOSX - x86_64 MozReview-Commit-ID: HVBRHUGP1J2
testing/mozharness/mozharness/base/script.py
--- a/testing/mozharness/mozharness/base/script.py
+++ b/testing/mozharness/mozharness/base/script.py
@@ -117,17 +117,19 @@ class PlatformMixin(object):
         if sys.platform.startswith("linux"):
             return True
 
     def _is_64_bit(self):
         if self._is_darwin():
             # osx is a special snowflake and to ensure the arch, it is better to use the following
             return sys.maxsize > 2**32  # context: https://docs.python.org/2/library/platform.html
         else:
-            return '64' in platform.architecture()[0]  # architecture() returns (bits, linkage)
+            # Using machine() gives you the architecture of the host rather
+            # than the build type of the Python binary
+            return '64' in platform.machine()
 
 
 # ScriptMixin {{{1
 class ScriptMixin(PlatformMixin):
     """This mixin contains simple filesystem commands and the like.
 
     It also contains some very special but very complex methods that,
     together with logging and config, provide the base for all scripts