Bug 1078380 - Make querying which operating system we run a script on more robust. r=armenzg
--- 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" \