OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (C) 2011 Google Inc. All rights reserved. | 3 # Copyright (C) 2011 Google Inc. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 16 matching lines...) Expand all Loading... |
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 # | 30 # |
31 | 31 |
32 # This script replaces calls to importScripts with script sources | 32 # This script replaces calls to importScripts with script sources |
33 # in input script file and dumps result into output script file. | 33 # in input script file and dumps result into output script file. |
34 | 34 |
35 from cStringIO import StringIO | 35 from cStringIO import StringIO |
36 | 36 |
37 import rjsmin | |
38 import os.path | 37 import os.path |
39 import re | 38 import re |
40 import sys | 39 import sys |
41 | 40 |
| 41 rjsmin_path = os.path.abspath(os.path.join( |
| 42 os.path.dirname(__file__), |
| 43 "..", |
| 44 "..", |
| 45 "build", |
| 46 "scripts")) |
| 47 sys.path.append(rjsmin_path) |
| 48 import rjsmin |
42 | 49 |
43 def main(argv): | 50 def main(argv): |
44 | 51 |
45 if len(argv) < 3: | 52 if len(argv) < 3: |
46 print('usage: %s input_file imports_dir output_file no_minify' % argv[0]
) | 53 print('usage: %s input_file imports_dir output_file no_minify' % argv[0]
) |
47 return 1 | 54 return 1 |
48 | 55 |
49 input_file_name = argv[1] | 56 input_file_name = argv[1] |
50 imports_dir = argv[2] | 57 imports_dir = argv[2] |
51 output_file_name = argv[3] | 58 output_file_name = argv[3] |
(...skipping 30 matching lines...) Expand all Loading... |
82 output_file.close() | 89 output_file.close() |
83 | 90 |
84 # Touch output file directory to make sure that Xcode will copy | 91 # Touch output file directory to make sure that Xcode will copy |
85 # modified resource files. | 92 # modified resource files. |
86 if sys.platform == 'darwin': | 93 if sys.platform == 'darwin': |
87 output_dir_name = os.path.dirname(output_file_name) | 94 output_dir_name = os.path.dirname(output_file_name) |
88 os.utime(output_dir_name, None) | 95 os.utime(output_dir_name, None) |
89 | 96 |
90 if __name__ == '__main__': | 97 if __name__ == '__main__': |
91 sys.exit(main(sys.argv)) | 98 sys.exit(main(sys.argv)) |
OLD | NEW |