Index: editor/tools/write_class_path_file.py |
=================================================================== |
--- editor/tools/write_class_path_file.py (revision 0) |
+++ editor/tools/write_class_path_file.py (revision 0) |
@@ -0,0 +1,34 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2013, 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. |
+# |
+# Script to write the class path manifest for usage in a jar files |
+# |
+# Usage: write_to_file.py output_file directory_containing_jar_files prefix |
+# |
+# The output file will contain a string like: |
+# Class-Path: . prefix/guava-13.0.1.jar prefix/commons-lang3-3.1.jar prefix/args4j-2.0.12.jar prefix/json.jar |
+ |
+import os |
+import sys |
+ |
+def main(): |
+ output = open(sys.argv[1], 'w') |
ahe
2013/02/14 14:52:34
I'd use:
with open(...) as output:
ricow1
2013/02/14 15:40:20
Done.
|
+ output.write('Class-Path:') |
ahe
2013/02/14 14:52:34
Here I would use:
print >> output, 'Class-Path:',
ricow1
2013/02/14 15:40:20
Done.
|
+ output.write(' .') |
+ prefix = '' |
+ if len(sys.argv) == 4: |
+ prefix = sys.argv[3] |
+ for r,d,f in os.walk(sys.argv[2]): |
+ for file in f: |
+ if file.endswith('.jar'): |
+ output.write(' ') |
+ output.write(prefix) |
+ output.write('/') |
+ output.write(file) |
+ output.write('\n') |
+ output.close() |
+ |
+if __name__=='__main__': |
+ main() |