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
--- 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