Skip to content
Snippets Groups Projects
Commit f72bc255 authored by Mike Hommey's avatar Mike Hommey
Browse files

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

parent 58500691
No related branches found
No related tags found
No related merge requests found
......@@ -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__':
......
......@@ -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'''
......
......@@ -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__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment