コード例 #1
0
ファイル: expandlibs_gen.py プロジェクト: garza/v8monkey
def generate(args):
    desc = LibDescriptor()
    for arg in args:
        if os.path.splitext(arg)[1] == conf.OBJ_SUFFIX:
            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))
    return desc
コード例 #2
0
 def test_read(self):
     '''Test LibDescriptor's initialization'''
     desc_list = ["# Comment",
                  "{0} = a b".format(LibDescriptor.KEYS[1]),
                  "", # Empty line
                  "foo = bar", # Should be discarded
                  "{0} = c d e".format(LibDescriptor.KEYS[0])]
     desc = LibDescriptor(desc_list)
     self.assertEqual(desc[LibDescriptor.KEYS[1]], ['a', 'b'])
     self.assertEqual(desc[LibDescriptor.KEYS[0]], ['c', 'd', 'e'])
     self.assertEqual(False, 'foo' in desc)
コード例 #3
0
 def test_serialize(self):
     '''Test LibDescriptor's serialization'''
     desc = LibDescriptor()
     desc[LibDescriptor.KEYS[0]] = ['a', 'b']
     self.assertEqual(str(desc), "%s = a b" % LibDescriptor.KEYS[0])
     desc['unsupported-key'] = ['a']
     self.assertEqual(str(desc), "%s = a b" % LibDescriptor.KEYS[0])
     desc[LibDescriptor.KEYS[1]] = ['c', 'd', 'e']
     self.assertEqual(str(desc), "%s = a b\n%s = c d e" % (LibDescriptor.KEYS[0], LibDescriptor.KEYS[1]))
     desc[LibDescriptor.KEYS[0]] = []
     self.assertEqual(str(desc), "%s = c d e" % (LibDescriptor.KEYS[1]))
コード例 #4
0
def generate(args):
    desc = LibDescriptor()
    for arg in args:
        if isObject(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
コード例 #5
0
def generate(args):
    desc = LibDescriptor()
    for arg in args:
        if isObject(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:
            # We want to skip static libraries with the name foo-rs-prelink
            # as they are individually linked for every final library, and
            # thus should not be included in the descriptor file
            if '-rs-prelink' in os.path.basename(arg):
                continue
            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