Bug 1078380 - Make querying which operating system we run a script on more robust. r=armenzg
authorSimarpreet Singh <s244sing@uwaterloo.ca>
Wed, 26 Nov 2014 09:21:52 -0500 (2014-11-26)
changeset 3434 274f6c156efa1118dec6cb1d895df5a40fbe48be
parent 3432 0117d7a3ab8ca77d6e6d9e26cba595ba56878174
child 3435 b695efb84faa62fe77830e0c762f971762274ae6
push id2658
push userarmenzg@mozilla.com
push dateWed, 26 Nov 2014 14:21:58 +0000 (2014-11-26)
reviewersarmenzg
bugs1078380
Bug 1078380 - Make querying which operating system we run a script on more robust. r=armenzg
mozharness/base/script.py
mozharness/mozilla/testing/testbase.py
--- a/mozharness/base/script.py
+++ b/mozharness/base/script.py
@@ -123,18 +123,27 @@ class ScriptMixin(object):
         system = platform.system()
         if system in ("Windows", "Microsoft"):
             return True
         if system.startswith("CYGWIN"):
             return True
         if os.name == 'nt':
             return True
 
-    def is_darwin(self):
-        return sys.platform.startswith("darwin")
+    def _is_darwin(self):
+        if platform.system() in ("Darwin"):
+            return True
+        if sys.platform.startswith("darwin"):
+            return True
+
+    def _is_linux(self):
+        if platform.system() in ("Linux"):
+            return True
+        if sys.platform.startswith("linux"):
+            return True
 
     def query_msys_path(self, path):
         if not isinstance(path, basestring):
             return path
         path = path.replace("\\", "/")
 
         def repl(m):
             return '/%s/' % m.group(1)
--- a/mozharness/mozilla/testing/testbase.py
+++ b/mozharness/mozilla/testing/testbase.py
@@ -311,17 +311,17 @@ You can set this by:
 
 1. specifying --test-url URL, or
 2. running via buildbot and running the read-buildbot-config action
 
 """
         if message:
             self.fatal(message + "Can't run download-and-extract... exiting")
 
-        if self.config.get("developer_mode") and self.is_darwin():
+        if self.config.get("developer_mode") and self._is_darwin():
             # Bug 1066700 only affects Mac users that try to run mozharness locally
             version = self._query_binary_version(
                     regex=re.compile("UnZip\ (\d+\.\d+)\ .*",re.MULTILINE),
                     cmd=[self.query_exe('unzip'), '-v']
             )
             if not version >= 6:
                 self.fatal("We require a more recent version of unzip to unpack our tests.zip files.\n" \
                         "You are currently using version %s. Please update to at least 6.0.\n" \