aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-03-02 17:02:26 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2015-03-02 17:02:26 +0200
commitf2de23982e00280edcb3ebcf017b8288871a219c (patch)
tree1c0cea6e98a6e1da13671246d92a843da6a3949e
parentb736e09e6bc562aa7169a5de9633c7c40d9dac7b (diff)
downloadmeson-f2de23982e00280edcb3ebcf017b8288871a219c.zip
meson-f2de23982e00280edcb3ebcf017b8288871a219c.tar.gz
meson-f2de23982e00280edcb3ebcf017b8288871a219c.tar.bz2
User optparse in symbolextractor.
-rwxr-xr-xsymbolextractor.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/symbolextractor.py b/symbolextractor.py
index 593b7aa..2f80fdc 100755
--- a/symbolextractor.py
+++ b/symbolextractor.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright 2013 The Meson development team
+# Copyright 2013-2015 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,14 +23,13 @@
# http://cgit.freedesktop.org/libreoffice/core/commit/?id=3213cd54b76bc80a6f0516aac75a48ff3b2ad67c
import sys, subprocess, platform
-from optparse import OptionParser
+import argparse
-usage_info = '%prog [options] <shared library> <symbol file>'
+parser = argparse.ArgumentParser()
-parser = OptionParser(usage=usage_info)
-
-parser.add_option('--cross-host', default=None, dest='cross_host',
+parser.add_argument('--cross-host', default=None, dest='cross_host',
help='cross compilation host platform')
+parser.add_argument('args', nargs='+')
def dummy_syms(outfilename):
"""Just touch it so relinking happens always."""
@@ -93,10 +92,10 @@ def gen_symbols(libfilename, outfilename, cross_host):
dummy_syms(outfilename)
if __name__ == '__main__':
- (options, args) = parser.parse_args(sys.argv)
- if len(args) != 3:
+ options = parser.parse_args()
+ if len(options.args) != 2:
print(sys.argv[0], '<shared library file> <output file>')
sys.exit(1)
- libfile = sys.argv[1]
- outfile = sys.argv[2]
+ libfile = options.args[0]
+ outfile = options.args[1]
gen_symbols(libfile, outfile, options.cross_host)