diff --git a/moz.configure b/moz.configure index 58bc27be5c38..43a0503b3879 100644 --- a/moz.configure +++ b/moz.configure @@ -316,7 +316,9 @@ def nsis_version(nsis): raise FatalCheckError('Unknown version of makensis') ver = Version(m.group(0)) - if ver < nsis_min_version: + # Versions comparisons don't quite work well with beta versions, so ensure + # it works for the non-beta version. + if ver < nsis_min_version and (ver >= '3.0a' or ver < '3'): raise FatalCheckError('To build the installer you must have NSIS' ' version %s or greater in your path' % nsis_min_version) diff --git a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py index 440191c6d7ea..7c318adefd0b 100644 --- a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py +++ b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py @@ -57,6 +57,37 @@ class TestMozConfigure(BaseConfigureTest): get_value_for(['--enable-application=browser', '--with-foo=foo bar'])) + def test_nsis_version(self): + this = self + + class FakeNSIS(object): + def __init__(self, version): + self.version = version + + def __call__(self, stdin, args): + this.assertEquals(args, ('-version',)) + return 0, self.version, '' + + def check_nsis_version(version): + sandbox = self.get_sandbox( + {'/usr/bin/makensis': FakeNSIS(version)}, {}, [], + {'PATH': '/usr/bin', 'MAKENSISU': '/usr/bin/makensis'}) + return sandbox._value_for(sandbox['nsis_version']) + + with self.assertRaises(SystemExit) as e: + check_nsis_version('v2.5') + + with self.assertRaises(SystemExit) as e: + check_nsis_version('v3.0a2') + + self.assertEquals(check_nsis_version('v3.0b1'), '3.0b1') + self.assertEquals(check_nsis_version('v3.0b2'), '3.0b2') + self.assertEquals(check_nsis_version('v3.0rc1'), '3.0rc1') + self.assertEquals(check_nsis_version('v3.0'), '3.0') + self.assertEquals(check_nsis_version('v3.0-2'), '3.0') + self.assertEquals(check_nsis_version('v3.0.1'), '3.0') + self.assertEquals(check_nsis_version('v3.1'), '3.1') + if __name__ == '__main__': main()