summaryrefslogtreecommitdiffstats
path: root/config/expandlibs_gen.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /config/expandlibs_gen.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'config/expandlibs_gen.py')
-rw-r--r--config/expandlibs_gen.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/config/expandlibs_gen.py b/config/expandlibs_gen.py
new file mode 100644
index 000000000..b1de63cd0
--- /dev/null
+++ b/config/expandlibs_gen.py
@@ -0,0 +1,41 @@
+# 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/.
+
+'''Given a list of object files and library names, prints a library
+descriptor to standard output'''
+
+from __future__ import with_statement
+import sys
+import os
+import expandlibs_config as conf
+from expandlibs import LibDescriptor, isObject, ensureParentDir
+from optparse import OptionParser
+
+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
+
+if __name__ == '__main__':
+ parser = OptionParser()
+ parser.add_option("-o", dest="output", metavar="FILE",
+ help="send output to the given file")
+
+ (options, args) = parser.parse_args()
+ if not options.output:
+ raise Exception("Missing option: -o")
+
+ ensureParentDir(options.output)
+ with open(options.output, 'w') as outfile:
+ print >>outfile, generate(args)