diff options
author | Yoav Alon <yoaval@checkpoint.com> | 2015-11-28 01:40:54 +0200 |
---|---|---|
committer | Yoav Alon <yoaval@checkpoint.com> | 2015-11-28 21:26:56 +0200 |
commit | a4809cf63291b3fa2eeb48a82094ca75d9a64113 (patch) | |
tree | 335c0f23d6a961fd4b04940ca9c7666b70c87b13 | |
parent | 33301dec0e068d0bfdc579aff2b40d2018402b4c (diff) | |
download | meson-a4809cf63291b3fa2eeb48a82094ca75d9a64113.zip meson-a4809cf63291b3fa2eeb48a82094ca75d9a64113.tar.gz meson-a4809cf63291b3fa2eeb48a82094ca75d9a64113.tar.bz2 |
Added support for extended command line to overcome OS command line length limitation
-rw-r--r-- | authors.txt | 1 | ||||
-rwxr-xr-x | meson.py | 3 | ||||
-rwxr-xr-x | mesonconf.py | 5 | ||||
-rw-r--r-- | mesonlib.py | 18 |
4 files changed, 26 insertions, 1 deletions
diff --git a/authors.txt b/authors.txt index 315c25a..c3720b5 100644 --- a/authors.txt +++ b/authors.txt @@ -24,3 +24,4 @@ German Diago Gomez Kyle Manna Haakon Sporsheim Wink Saville +Yoav Alon
\ No newline at end of file @@ -174,6 +174,9 @@ def run(args): handshake = True else: handshake = False + args = mesonlib.expand_arguments(args) + if not args: + return 1 options = parser.parse_args(args[1:]) if options.print_version: print(coredata.version) diff --git a/mesonconf.py b/mesonconf.py index 228ace5..e53875f 100755 --- a/mesonconf.py +++ b/mesonconf.py @@ -180,7 +180,10 @@ class Conf: self.print_aligned(optarr) if __name__ == '__main__': - options = parser.parse_args() + args = mesonlib.expand_arguments(sys.argv[:]) + if not args: + sys.exit(1) + options = parser.parse_args(args[1:]) if len(options.directory) > 1: print('%s <build directory>' % sys.argv[0]) print('If you omit the build directory, the current directory is substituted.') diff --git a/mesonlib.py b/mesonlib.py index bb69632..99d6154 100644 --- a/mesonlib.py +++ b/mesonlib.py @@ -264,3 +264,21 @@ def stringlistify(item): if not isinstance(i, str): raise MesonException('List item not a string.') return item + +def expand_arguments(args): + expended_args = [] + for arg in args: + if not arg.startswith('@'): + expended_args.append(arg) + continue + + args_file = arg[1:] + try: + with open(args_file) as f: + extended_args = f.read().split() + expended_args += extended_args + except Exception as e: + print('Error expanding command line arguments, %s not found' % args_file) + print(e) + return None + return expended_args |