OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (C) 2010 Google Inc. All rights reserved. | 3 # Copyright (C) 2010 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 19 matching lines...) Expand all Loading... |
30 # | 30 # |
31 | 31 |
32 # This script concatenates in place JS files in the order specified | 32 # This script concatenates in place JS files in the order specified |
33 # using <script> tags in a given 'order.html' file. | 33 # using <script> tags in a given 'order.html' file. |
34 | 34 |
35 from __future__ import with_statement | 35 from __future__ import with_statement |
36 | 36 |
37 from HTMLParser import HTMLParser | 37 from HTMLParser import HTMLParser |
38 from cStringIO import StringIO | 38 from cStringIO import StringIO |
39 | 39 |
40 import rjsmin | |
41 import os.path | 40 import os.path |
42 import sys | 41 import sys |
43 | 42 |
| 43 rjsmin_path = os.path.abspath(os.path.join( |
| 44 os.path.dirname(__file__), |
| 45 "..", |
| 46 "..", |
| 47 "build", |
| 48 "scripts")) |
| 49 sys.path.append(rjsmin_path) |
| 50 import rjsmin |
| 51 |
44 | 52 |
45 class OrderedJSFilesExtractor(HTMLParser): | 53 class OrderedJSFilesExtractor(HTMLParser): |
46 | 54 |
47 def __init__(self, order_html): | 55 def __init__(self, order_html): |
48 HTMLParser.__init__(self) | 56 HTMLParser.__init__(self) |
49 self.ordered_js_files = [] | 57 self.ordered_js_files = [] |
50 self.feed(order_html) | 58 self.feed(order_html) |
51 | 59 |
52 def handle_starttag(self, tag, attrs): | 60 def handle_starttag(self, tag, attrs): |
53 if tag == 'script': | 61 if tag == 'script': |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 output.close() | 117 output.close() |
110 | 118 |
111 # Touch output file directory to make sure that Xcode will copy | 119 # Touch output file directory to make sure that Xcode will copy |
112 # modified resource files. | 120 # modified resource files. |
113 if sys.platform == 'darwin': | 121 if sys.platform == 'darwin': |
114 output_dir_name = os.path.dirname(output_file_name) | 122 output_dir_name = os.path.dirname(output_file_name) |
115 os.utime(output_dir_name, None) | 123 os.utime(output_dir_name, None) |
116 | 124 |
117 if __name__ == '__main__': | 125 if __name__ == '__main__': |
118 sys.exit(main(sys.argv)) | 126 sys.exit(main(sys.argv)) |
OLD | NEW |