Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: remoting/webapp/build-webapp.py

Issue 20985002: Localized Chromoting Host on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/unittests-Info.plist ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 # to create a symlink in that case. 117 # to create a symlink in that case.
118 targetname = os.path.relpath(os.path.realpath(current_file), 118 targetname = os.path.relpath(os.path.realpath(current_file),
119 os.path.realpath(destination_file)) 119 os.path.realpath(destination_file))
120 os.symlink(targetname, destination_file) 120 os.symlink(targetname, destination_file)
121 else: 121 else:
122 shutil.copy2(current_file, destination_file) 122 shutil.copy2(current_file, destination_file)
123 123
124 # Copy all the locales, preserving directory structure 124 # Copy all the locales, preserving directory structure
125 destination_locales = os.path.join(destination, "_locales") 125 destination_locales = os.path.join(destination, "_locales")
126 os.mkdir(destination_locales , 0775) 126 os.mkdir(destination_locales , 0775)
127 locale_dir = "/_locales/" 127 remoting_locales = os.path.join(destination, "remoting_locales")
128 os.mkdir(remoting_locales , 0775)
128 for current_locale in locales: 129 for current_locale in locales:
129 pos = current_locale.find(locale_dir) 130 extension = os.path.splitext(current_locale)[1]
130 if (pos == -1): 131 if extension == '.json':
131 raise Exception("Missing locales directory in " + current_locale) 132 locale_id = os.path.split(os.path.split(current_locale)[0])[1]
132 subtree = current_locale[pos + len(locale_dir):] 133 destination_dir = os.path.join(destination_locales, locale_id)
133 pos = subtree.find("/") 134 destination_file = os.path.join(destination_dir,
134 if (pos == -1): 135 os.path.split(current_locale)[1])
135 raise Exception("Malformed locale: " + current_locale) 136 os.mkdir(destination_dir, 0775)
136 locale_id = subtree[:pos] 137 shutil.copy2(current_locale, destination_file)
137 messages = subtree[pos+1:] 138 elif extension == '.pak':
138 destination_dir = os.path.join(destination_locales, locale_id) 139 destination_file = os.path.join(remoting_locales,
139 destination_file = os.path.join(destination_dir, messages) 140 os.path.split(current_locale)[1])
140 os.mkdir(destination_dir, 0775) 141 shutil.copy2(current_locale, destination_file)
141 shutil.copy2(current_locale, destination_file) 142 else:
143 raise Exception("Unknown extension: " + current_locale);
142 144
143 # Create fake plugin files to appease the manifest checker. 145 # Create fake plugin files to appease the manifest checker.
144 # It requires that if there is a plugin listed in the manifest that 146 # It requires that if there is a plugin listed in the manifest that
145 # there be a file in the plugin with that name. 147 # there be a file in the plugin with that name.
146 names = [ 148 names = [
147 'remoting_host_plugin.dll', # Windows 149 'remoting_host_plugin.dll', # Windows
148 'remoting_host_plugin.plugin', # Mac 150 'remoting_host_plugin.plugin', # Mac
149 'libremoting_host_plugin.ia32.so', # Linux 32 151 'libremoting_host_plugin.ia32.so', # Linux 32
150 'libremoting_host_plugin.x64.so' # Linux 64 152 'libremoting_host_plugin.x64.so' # Linux 64
151 ] 153 ]
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 patches.append(arg) 322 patches.append(arg)
321 else: 323 else:
322 files.append(arg) 324 files.append(arg)
323 325
324 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], 326 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4],
325 sys.argv[5], sys.argv[6], files, locales, patches) 327 sys.argv[5], sys.argv[6], files, locales, patches)
326 328
327 329
328 if __name__ == '__main__': 330 if __name__ == '__main__':
329 sys.exit(main()) 331 sys.exit(main())
OLDNEW
« no previous file with comments | « remoting/unittests-Info.plist ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698