Added support for extended command line to overcome OS command line length limitation

pull/319/head
Yoav Alon 9 years ago
parent 33301dec0e
commit a4809cf632
  1. 1
      authors.txt
  2. 3
      meson.py
  3. 5
      mesonconf.py
  4. 18
      mesonlib.py

@ -24,3 +24,4 @@ German Diago Gomez
Kyle Manna Kyle Manna
Haakon Sporsheim Haakon Sporsheim
Wink Saville Wink Saville
Yoav Alon

@ -174,6 +174,9 @@ def run(args):
handshake = True handshake = True
else: else:
handshake = False handshake = False
args = mesonlib.expand_arguments(args)
if not args:
return 1
options = parser.parse_args(args[1:]) options = parser.parse_args(args[1:])
if options.print_version: if options.print_version:
print(coredata.version) print(coredata.version)

@ -180,7 +180,10 @@ class Conf:
self.print_aligned(optarr) self.print_aligned(optarr)
if __name__ == '__main__': 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: if len(options.directory) > 1:
print('%s <build directory>' % sys.argv[0]) print('%s <build directory>' % sys.argv[0])
print('If you omit the build directory, the current directory is substituted.') print('If you omit the build directory, the current directory is substituted.')

@ -264,3 +264,21 @@ def stringlistify(item):
if not isinstance(i, str): if not isinstance(i, str):
raise MesonException('List item not a string.') raise MesonException('List item not a string.')
return item 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

Loading…
Cancel
Save