diff --git a/config/expandlibs_gen.py b/config/expandlibs_gen.py index f6d26d3c3d1c0c4c73936ce9de0cd777da3a8773..0a19c5013d10300c989b844840d0ffaa19995227 100644 --- a/config/expandlibs_gen.py +++ b/config/expandlibs_gen.py @@ -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__': diff --git a/config/tests/unit-expandlibs.py b/config/tests/unit-expandlibs.py index 491c95448b1fd94e2073208eabbf146519104953..a7ab6d1c23e359e6d5c9343340e9bd1df9b417eb 100644 --- a/config/tests/unit-expandlibs.py +++ b/config/tests/unit-expandlibs.py @@ -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''' diff --git a/js/src/config/expandlibs_gen.py b/js/src/config/expandlibs_gen.py index f6d26d3c3d1c0c4c73936ce9de0cd777da3a8773..0a19c5013d10300c989b844840d0ffaa19995227 100644 --- a/js/src/config/expandlibs_gen.py +++ b/js/src/config/expandlibs_gen.py @@ -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__':