From a084eea7fb9b6a02f985e79e9791c0731f0b1789 Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Fri, 5 Sep 2014 17:30:59 +0200 Subject: [PATCH] Bug 1061809 - [mozversion] Update retrieval of application information due to upcoming Mac signing changes. r=wlach --- .../mozversion/mozversion/mozversion.py | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/testing/mozbase/mozversion/mozversion/mozversion.py b/testing/mozbase/mozversion/mozversion/mozversion.py index 17ea89efa70..dfbb911b03d 100644 --- a/testing/mozbase/mozversion/mozversion/mozversion.py +++ b/testing/mozbase/mozversion/mozversion/mozversion.py @@ -85,18 +85,24 @@ class LocalVersion(Version): def __init__(self, binary, **kwargs): Version.__init__(self, **kwargs) - path = None + path = os.getcwd() if binary: if not os.path.exists(binary): raise IOError('Binary path does not exist: %s' % binary) - path = os.path.dirname(binary) - else: - if os.path.exists(os.path.join(os.getcwd(), 'application.ini')): - path = os.getcwd() + path = os.path.dirname(os.path.abspath(binary)) - if not path: - raise LocalAppNotFoundError() + if not os.path.exists(os.path.join(path, 'application.ini')): + # With new signed builds on OS X the ini files are located inside + # of '/Contents/Resources'. Older builds have them next to the + # binaries in '/Contents/MacOS'. + if sys.platform == 'darwin': + path = os.path.join(os.path.dirname(path), 'Resources') + + if not os.path.exists(os.path.join(path, 'application.ini')): + raise LocalAppNotFoundError() + else: + raise LocalAppNotFoundError() self.get_gecko_info(path) @@ -275,7 +281,8 @@ def cli(args=sys.argv[1:]): dm_type = os.environ.get('DM_TRANS', 'adb') host = os.environ.get('TEST_DEVICE') - version = get_version(binary=options.binary, sources=options.sources, + version = get_version(binary=options.binary, + sources=options.sources, dm_type=dm_type, host=host, device_serial=options.device) for (key, value) in sorted(version.items()):