| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Creates a directory with with the unpacked contents of the remoting webapp. | 6 """Creates a directory with with the unpacked contents of the remoting webapp. |
| 7 | 7 |
| 8 The directory will contain a copy-of or a link-to to all remoting webapp | 8 The directory will contain a copy-of or a link-to to all remoting webapp |
| 9 resources. This includes HTML/JS and any plugin binaries. The script also | 9 resources. This includes HTML/JS and any plugin binaries. The script also |
| 10 massages resulting files appropriately with host plugin data. Finally, | 10 massages resulting files appropriately with host plugin data. Finally, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 # to create a symlink in that case. | 95 # to create a symlink in that case. |
| 96 targetname = os.path.relpath(os.path.realpath(current_file), | 96 targetname = os.path.relpath(os.path.realpath(current_file), |
| 97 os.path.realpath(destination_file)) | 97 os.path.realpath(destination_file)) |
| 98 os.symlink(targetname, destination_file) | 98 os.symlink(targetname, destination_file) |
| 99 else: | 99 else: |
| 100 shutil.copy2(current_file, destination_file) | 100 shutil.copy2(current_file, destination_file) |
| 101 | 101 |
| 102 # Copy all the locales, preserving directory structure | 102 # Copy all the locales, preserving directory structure |
| 103 destination_locales = os.path.join(destination, "_locales") | 103 destination_locales = os.path.join(destination, "_locales") |
| 104 os.mkdir(destination_locales , 0775) | 104 os.mkdir(destination_locales , 0775) |
| 105 chromium_locale_dir = "/_locales/" |
| 106 chrome_locale_dir = "/_locales.official/" |
| 105 for current_locale in locales: | 107 for current_locale in locales: |
| 106 pos = current_locale.find("/_locales/") | 108 pos = current_locale.find(chromium_locale_dir) |
| 109 locale_len = len(chromium_locale_dir) |
| 110 if (pos == -1): |
| 111 pos = current_locale.find(chrome_locale_dir) |
| 112 locale_len = len(chrome_locale_dir) |
| 107 if (pos == -1): | 113 if (pos == -1): |
| 108 raise "Missing locales directory in " + current_locale | 114 raise "Missing locales directory in " + current_locale |
| 109 subtree = current_locale[pos+10:] | 115 subtree = current_locale[pos+locale_len:] |
| 110 pos = subtree.find("/") | 116 pos = subtree.find("/") |
| 111 if (pos == -1): | 117 if (pos == -1): |
| 112 raise "Malformed locale: " + current_locale | 118 raise "Malformed locale: " + current_locale |
| 113 locale_id = subtree[:pos] | 119 locale_id = subtree[:pos] |
| 114 messages = subtree[pos+1:] | 120 messages = subtree[pos+1:] |
| 115 destination_dir = os.path.join(destination_locales, locale_id) | 121 destination_dir = os.path.join(destination_locales, locale_id) |
| 116 destination_file = os.path.join(destination_dir, messages) | 122 destination_file = os.path.join(destination_dir, messages) |
| 117 os.mkdir(destination_dir, 0775) | 123 os.mkdir(destination_dir, 0775) |
| 118 shutil.copy2(current_locale, destination_file) | 124 shutil.copy2(current_locale, destination_file) |
| 119 | 125 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 locales.append(arg) | 182 locales.append(arg) |
| 177 else: | 183 else: |
| 178 files.append(arg) | 184 files.append(arg) |
| 179 | 185 |
| 180 buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], | 186 buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], |
| 181 sys.argv[5], files, locales) | 187 sys.argv[5], files, locales) |
| 182 | 188 |
| 183 | 189 |
| 184 if __name__ == '__main__': | 190 if __name__ == '__main__': |
| 185 main() | 191 main() |
| OLD | NEW |