Bug 741287 - Make expandlibs_gen.py error out when given a missing file. r=ted

This commit is contained in:
Mike Hommey 2012-04-06 10:16:25 +02:00
parent ce926d8719
commit 24eb677c51
3 changed files with 21 additions and 8 deletions

View File

@ -47,10 +47,15 @@ def generate(args):
desc = LibDescriptor()
for arg in args:
if isObject(arg):
desc['OBJS'].append(os.path.abspath(arg))
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX and \
(os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX)):
desc['LIBS'].append(os.path.abspath(arg))
if os.path.exists(arg):
desc['OBJS'].append(os.path.abspath(arg))
else:
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
if __name__ == '__main__':

View File

@ -145,6 +145,9 @@ class TestExpandLibsGen(TestCaseWithTmpDir):
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.assertRaises(Exception, generate, files + [self.tmpfile(Obj('z'))])
self.assertRaises(Exception, generate, files + [self.tmpfile(Lib('y'))])
class TestExpandInit(TestCaseWithTmpDir):
def init(self):
''' Initializes test environment for library expansion tests'''

View File

@ -47,10 +47,15 @@ def generate(args):
desc = LibDescriptor()
for arg in args:
if isObject(arg):
desc['OBJS'].append(os.path.abspath(arg))
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX and \
(os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX)):
desc['LIBS'].append(os.path.abspath(arg))
if os.path.exists(arg):
desc['OBJS'].append(os.path.abspath(arg))
else:
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
if __name__ == '__main__':