Bug 1311871 - Fix NSIS version check for NSIS version 3.0. r=chmanchester

--HG--
extra : rebase_source : 5e99dc999e2c54813ec447134bc4b008f7af826a
This commit is contained in:
Mike Hommey 2016-10-21 09:15:34 +09:00
Родитель a0c9c90951
Коммит 2a9930daf9
2 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -316,7 +316,9 @@ def nsis_version(nsis):
raise FatalCheckError('Unknown version of makensis') raise FatalCheckError('Unknown version of makensis')
ver = Version(m.group(0)) 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' raise FatalCheckError('To build the installer you must have NSIS'
' version %s or greater in your path' ' version %s or greater in your path'
% nsis_min_version) % nsis_min_version)

Просмотреть файл

@ -57,6 +57,37 @@ class TestMozConfigure(BaseConfigureTest):
get_value_for(['--enable-application=browser', get_value_for(['--enable-application=browser',
'--with-foo=foo bar'])) '--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__': if __name__ == '__main__':
main() main()