| Index: dart/runtime/tools/concat_library.py
|
| diff --git a/dart/runtime/tools/concat_library.py b/dart/runtime/tools/concat_library.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..838bd426a3f6eab1aa6c9e4d83de65517343a911
|
| --- /dev/null
|
| +++ b/dart/runtime/tools/concat_library.py
|
| @@ -0,0 +1,40 @@
|
| +#!/usr/bin/env python
|
| +# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| +# for details. All rights reserved. Use of this source code is governed by a
|
| +# BSD-style license that can be found in the LICENSE file.
|
| +
|
| +import optparse
|
| +import shutil
|
| +import sys
|
| +
|
| +def parse_options(argv):
|
| + parser = optparse.OptionParser(usage="Usage: %prog [options] files")
|
| + parser.add_option("--output",
|
| + dest="output",
|
| + help="Write output to FILE.",
|
| + metavar="FILE")
|
| + (options, arguments) = parser.parse_args(argv[1:])
|
| + if not arguments:
|
| + parser.error("At least one input file must be provided.")
|
| + if not options.output:
|
| + parser.error("No --output provided.")
|
| + return (options, arguments)
|
| +
|
| +
|
| +def main():
|
| + # Print the command that is being run. This is helpful when
|
| + # debugging build errors.
|
| + sys.stderr.write('%s\n' % ' '.join(sys.argv))
|
| + (options, arguments) = parse_options(sys.argv)
|
| + tmp_name = '%s.tmp' % options.output
|
| + with open(tmp_name, 'w') as output:
|
| + for source in arguments:
|
| + with open(source, 'r') as inpt:
|
| + for line in inpt:
|
| + if line.startswith('#source'):
|
| + line = '// %s' % line
|
| + output.write(line)
|
| + shutil.move(tmp_name, options.output)
|
| +
|
| +if __name__ == '__main__':
|
| + main()
|
|
|