2012-05-21 04:12:37 -07:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2011-02-25 06:05:08 -08:00
|
|
|
|
|
|
|
'''Given a list of object files and library names, prints a library
|
|
|
|
descriptor to standard output'''
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import expandlibs_config as conf
|
2012-01-25 01:34:14 -08:00
|
|
|
from expandlibs import LibDescriptor, isObject
|
2011-02-25 06:05:08 -08:00
|
|
|
|
|
|
|
def generate(args):
|
|
|
|
desc = LibDescriptor()
|
|
|
|
for arg in args:
|
2012-01-25 01:34:14 -08:00
|
|
|
if isObject(arg):
|
2012-04-06 01:16:25 -07:00
|
|
|
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)
|
2011-02-25 06:05:08 -08:00
|
|
|
return desc
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
print generate(sys.argv[1:])
|