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

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

Issue 343983003: Use PNaCl in V2 builds of the remoting webapp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 manifest_template, webapp_type, files, locales): 79 manifest_template, webapp_type, files, locales):
80 """Does the main work of building the webapp directory and zipfile. 80 """Does the main work of building the webapp directory and zipfile.
81 81
82 Args: 82 Args:
83 buildtype: the type of build ("Official" or "Dev"). 83 buildtype: the type of build ("Official" or "Dev").
84 destination: A string with path to directory where the webapp will be 84 destination: A string with path to directory where the webapp will be
85 written. 85 written.
86 zipfile: A string with path to the zipfile to create containing the 86 zipfile: A string with path to the zipfile to create containing the
87 contents of |destination|. 87 contents of |destination|.
88 manifest_template: jinja2 template file for manifest. 88 manifest_template: jinja2 template file for manifest.
89 webapp_type: webapp type ("v1", "v2" or "v2_pnacl"). 89 webapp_type: webapp type ("v1" or "v2").
90 files: An array of strings listing the paths for resources to include 90 files: An array of strings listing the paths for resources to include
91 in this webapp. 91 in this webapp.
92 locales: An array of strings listing locales, which are copied, along 92 locales: An array of strings listing locales, which are copied, along
93 with their directory structure from the _locales directory down. 93 with their directory structure from the _locales directory down.
94 """ 94 """
95 # Ensure a fresh directory. 95 # Ensure a fresh directory.
96 try: 96 try:
97 shutil.rmtree(destination) 97 shutil.rmtree(destination)
98 except OSError: 98 except OSError:
99 if os.path.exists(destination): 99 if os.path.exists(destination):
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 os.mkdir(destination_dir, 0775) 143 os.mkdir(destination_dir, 0775)
144 shutil.copy2(current_locale, destination_file) 144 shutil.copy2(current_locale, destination_file)
145 elif extension == '.pak': 145 elif extension == '.pak':
146 destination_file = os.path.join(remoting_locales, 146 destination_file = os.path.join(remoting_locales,
147 os.path.split(current_locale)[1]) 147 os.path.split(current_locale)[1])
148 shutil.copy2(current_locale, destination_file) 148 shutil.copy2(current_locale, destination_file)
149 else: 149 else:
150 raise Exception("Unknown extension: " + current_locale); 150 raise Exception("Unknown extension: " + current_locale);
151 151
152 # Set client plugin type. 152 # Set client plugin type.
153 client_plugin = 'pnacl' if webapp_type == 'v2_pnacl' else 'native' 153 client_plugin = 'pnacl' if webapp_type == 'v2' else 'native'
154 findAndReplace(os.path.join(destination, 'plugin_settings.js'), 154 findAndReplace(os.path.join(destination, 'plugin_settings.js'),
155 "'CLIENT_PLUGIN_TYPE'", "'" + client_plugin + "'") 155 "'CLIENT_PLUGIN_TYPE'", "'" + client_plugin + "'")
156 156
157 # Allow host names for google services/apis to be overriden via env vars. 157 # Allow host names for google services/apis to be overriden via env vars.
158 oauth2AccountsHost = os.environ.get( 158 oauth2AccountsHost = os.environ.get(
159 'OAUTH2_ACCOUNTS_HOST', 'https://accounts.google.com') 159 'OAUTH2_ACCOUNTS_HOST', 'https://accounts.google.com')
160 oauth2ApiHost = os.environ.get( 160 oauth2ApiHost = os.environ.get(
161 'OAUTH2_API_HOST', 'https://www.googleapis.com') 161 'OAUTH2_API_HOST', 'https://www.googleapis.com')
162 directoryApiHost = os.environ.get( 162 directoryApiHost = os.environ.get(
163 'DIRECTORY_API_HOST', 'https://www.googleapis.com') 163 'DIRECTORY_API_HOST', 'https://www.googleapis.com')
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 locales.append(arg) 279 locales.append(arg)
280 else: 280 else:
281 files.append(arg) 281 files.append(arg)
282 282
283 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], 283 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4],
284 sys.argv[5], sys.argv[6], files, locales) 284 sys.argv[5], sys.argv[6], files, locales)
285 285
286 286
287 if __name__ == '__main__': 287 if __name__ == '__main__':
288 sys.exit(main()) 288 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698