зеркало из https://github.com/mozilla/pjs.git
Bug 741287 - Make expandlibs_gen.py error out when given a missing file. r=ted
This commit is contained in:
Родитель
ce26e78aec
Коммит
1b5a1b585e
|
@ -47,10 +47,15 @@ def generate(args):
|
||||||
desc = LibDescriptor()
|
desc = LibDescriptor()
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if isObject(arg):
|
if isObject(arg):
|
||||||
desc['OBJS'].append(os.path.abspath(arg))
|
if os.path.exists(arg):
|
||||||
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX and \
|
desc['OBJS'].append(os.path.abspath(arg))
|
||||||
(os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX)):
|
else:
|
||||||
desc['LIBS'].append(os.path.abspath(arg))
|
raise Exception("File not found: %s" % arg)
|
||||||
|
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
|
||||||
|
if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
|
||||||
|
desc['LIBS'].append(os.path.abspath(arg))
|
||||||
|
else:
|
||||||
|
raise Exception("File not found: %s" % arg)
|
||||||
return desc
|
return desc
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -145,6 +145,9 @@ class TestExpandLibsGen(TestCaseWithTmpDir):
|
||||||
self.assertEqual(desc['OBJS'], [self.tmpfile(Obj(s)) for s in ['b', 'd', 'e']])
|
self.assertEqual(desc['OBJS'], [self.tmpfile(Obj(s)) for s in ['b', 'd', 'e']])
|
||||||
self.assertEqual(desc['LIBS'], [self.tmpfile(Lib(s)) for s in ['a', 'c', 'f']])
|
self.assertEqual(desc['LIBS'], [self.tmpfile(Lib(s)) for s in ['a', 'c', 'f']])
|
||||||
|
|
||||||
|
self.assertRaises(Exception, generate, files + [self.tmpfile(Obj('z'))])
|
||||||
|
self.assertRaises(Exception, generate, files + [self.tmpfile(Lib('y'))])
|
||||||
|
|
||||||
class TestExpandInit(TestCaseWithTmpDir):
|
class TestExpandInit(TestCaseWithTmpDir):
|
||||||
def init(self):
|
def init(self):
|
||||||
''' Initializes test environment for library expansion tests'''
|
''' Initializes test environment for library expansion tests'''
|
||||||
|
|
|
@ -47,10 +47,15 @@ def generate(args):
|
||||||
desc = LibDescriptor()
|
desc = LibDescriptor()
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if isObject(arg):
|
if isObject(arg):
|
||||||
desc['OBJS'].append(os.path.abspath(arg))
|
if os.path.exists(arg):
|
||||||
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX and \
|
desc['OBJS'].append(os.path.abspath(arg))
|
||||||
(os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX)):
|
else:
|
||||||
desc['LIBS'].append(os.path.abspath(arg))
|
raise Exception("File not found: %s" % arg)
|
||||||
|
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
|
||||||
|
if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
|
||||||
|
desc['LIBS'].append(os.path.abspath(arg))
|
||||||
|
else:
|
||||||
|
raise Exception("File not found: %s" % arg)
|
||||||
return desc
|
return desc
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Загрузка…
Ссылка в новой задаче