OLD | NEW |
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 import jinja2 | 101 import jinja2 |
102 (template_path, template_name) = os.path.split(input_file) | 102 (template_path, template_name) = os.path.split(input_file) |
103 include_paths = [template_path] + include_paths | 103 include_paths = [template_path] + include_paths |
104 env = jinja2.Environment(loader=jinja2.FileSystemLoader(include_paths)) | 104 env = jinja2.Environment(loader=jinja2.FileSystemLoader(include_paths)) |
105 template = env.get_template(template_name) | 105 template = env.get_template(template_name) |
106 rendered = template.render(context) | 106 rendered = template.render(context) |
107 io.open(output_file, 'w', encoding='utf-8').write(rendered) | 107 io.open(output_file, 'w', encoding='utf-8').write(rendered) |
108 | 108 |
109 | 109 |
110 def buildWebApp(buildtype, version, destination, zip_path, | 110 def buildWebApp(buildtype, version, destination, zip_path, |
111 manifest_template, webapp_type, appid, app_client_id, app_name, | 111 manifest_template, appid, app_client_id, app_name, |
112 app_description, app_capabilities, manifest_key, files, | 112 app_description, app_capabilities, manifest_key, files, |
113 files_listfile, locales_listfile, jinja_paths, | 113 files_listfile, locales_listfile, jinja_paths, |
114 service_environment, use_gcd): | 114 service_environment, use_gcd): |
115 """Does the main work of building the webapp directory and zipfile. | 115 """Does the main work of building the webapp directory and zipfile. |
116 | 116 |
117 Args: | 117 Args: |
118 buildtype: the type of build ("Official", "Release" or "Dev"). | 118 buildtype: the type of build ("Official", "Release" or "Dev"). |
119 destination: A string with path to directory where the webapp will be | 119 destination: A string with path to directory where the webapp will be |
120 written. | 120 written. |
121 zipfile: A string with path to the zipfile to create containing the | 121 zipfile: A string with path to the zipfile to create containing the |
122 contents of |destination|. | 122 contents of |destination|. |
123 manifest_template: jinja2 template file for manifest. | 123 manifest_template: jinja2 template file for manifest. |
124 webapp_type: webapp type: | |
125 For DesktopRemoting: "desktop" | |
126 For AppRemoting: "app_remoting" or "shared_module" | |
127 appid: A string with the Remoting Application Id (only used for app | 124 appid: A string with the Remoting Application Id (only used for app |
128 remoting webapps). If supplied, it defaults to using the | 125 remoting webapps). If supplied, it defaults to using the |
129 test API server. | 126 test API server. |
130 app_client_id: The OAuth2 client ID for the webapp. | 127 app_client_id: The OAuth2 client ID for the webapp. |
131 app_name: A string with the name of the application. | 128 app_name: A string with the name of the application. |
132 app_description: A string with the description of the application. | 129 app_description: A string with the description of the application. |
133 app_capabilities: A set of strings naming the capabilities that should be | 130 app_capabilities: A set of strings naming the capabilities that should be |
134 enabled for this application. | 131 enabled for this application. |
135 manifest_key: The manifest key for the webapp. | 132 manifest_key: The manifest key for the webapp. |
136 files: An array of strings listing the paths for resources to include | 133 files: An array of strings listing the paths for resources to include |
(...skipping 19 matching lines...) Expand all Loading... |
156 with open(locales_listfile) as input: | 153 with open(locales_listfile) as input: |
157 for s in input: | 154 for s in input: |
158 locales.append(s.rstrip()) | 155 locales.append(s.rstrip()) |
159 | 156 |
160 # Load the files from the files_listfile. | 157 # Load the files from the files_listfile. |
161 if files_listfile: | 158 if files_listfile: |
162 with open(files_listfile) as input: | 159 with open(files_listfile) as input: |
163 for s in input: | 160 for s in input: |
164 files.append(s.rstrip()) | 161 files.append(s.rstrip()) |
165 | 162 |
166 # Ensure a fresh directory. | 163 #Ensure a fresh directory. |
167 try: | 164 try: |
168 shutil.rmtree(destination) | 165 shutil.rmtree(destination) |
169 except OSError: | 166 except OSError: |
170 if os.path.exists(destination): | 167 if os.path.exists(destination): |
171 raise | 168 raise |
172 else: | 169 else: |
173 pass | 170 pass |
174 os.makedirs(destination, 0775) | 171 os.makedirs(destination, 0775) |
175 | 172 |
176 if buildtype != 'Official' and buildtype != 'Release' and buildtype != 'Dev': | 173 if buildtype != 'Official' and buildtype != 'Release' and buildtype != 'Dev': |
177 raise Exception('Unknown buildtype: ' + buildtype) | 174 raise Exception('Unknown buildtype: ' + buildtype) |
178 | 175 |
179 jinja_context = { | 176 jinja_context = { |
180 'webapp_type': webapp_type, | |
181 'buildtype': buildtype, | 177 'buildtype': buildtype, |
182 } | 178 } |
183 | 179 |
184 # Copy all the files. | 180 # Copy all the files. |
185 for current_file in files: | 181 for current_file in files: |
186 destination_file = os.path.join(destination, os.path.basename(current_file)) | 182 destination_file = os.path.join(destination, os.path.basename(current_file)) |
187 | 183 |
188 # Process *.jinja2 files as jinja2 templates | 184 # Process *.jinja2 files as jinja2 templates |
189 if current_file.endswith(".jinja2"): | 185 if current_file.endswith(".jinja2"): |
190 destination_file = destination_file[:-len(".jinja2")] | 186 destination_file = destination_file[:-len(".jinja2")] |
(...skipping 16 matching lines...) Expand all Loading... |
207 os.path.split(current_locale)[1]) | 203 os.path.split(current_locale)[1]) |
208 os.mkdir(destination_dir, 0775) | 204 os.mkdir(destination_dir, 0775) |
209 shutil.copy2(current_locale, destination_file) | 205 shutil.copy2(current_locale, destination_file) |
210 elif extension == '.pak': | 206 elif extension == '.pak': |
211 destination_file = os.path.join(remoting_locales, | 207 destination_file = os.path.join(remoting_locales, |
212 os.path.split(current_locale)[1]) | 208 os.path.split(current_locale)[1]) |
213 shutil.copy2(current_locale, destination_file) | 209 shutil.copy2(current_locale, destination_file) |
214 else: | 210 else: |
215 raise Exception('Unknown extension: ' + current_locale) | 211 raise Exception('Unknown extension: ' + current_locale) |
216 | 212 |
217 is_app_remoting_webapp = webapp_type == 'app_remoting' | |
218 is_app_remoting_shared_module = webapp_type == 'shared_module' | |
219 is_app_remoting = is_app_remoting_webapp or is_app_remoting_shared_module | |
220 is_prod_service_environment = service_environment == 'prod' | 213 is_prod_service_environment = service_environment == 'prod' |
221 is_desktop_remoting = not is_app_remoting | |
222 | 214 |
223 # Allow host names for google services/apis to be overriden via env vars. | 215 # Allow host names for google services/apis to be overriden via env vars. |
224 oauth2AccountsHost = os.environ.get( | 216 oauth2AccountsHost = os.environ.get( |
225 'OAUTH2_ACCOUNTS_HOST', 'https://accounts.google.com') | 217 'OAUTH2_ACCOUNTS_HOST', 'https://accounts.google.com') |
226 oauth2ApiHost = os.environ.get( | 218 oauth2ApiHost = os.environ.get( |
227 'OAUTH2_API_HOST', 'https://www.googleapis.com') | 219 'OAUTH2_API_HOST', 'https://www.googleapis.com') |
228 directoryApiHost = os.environ.get( | 220 directoryApiHost = os.environ.get( |
229 'DIRECTORY_API_HOST', 'https://www.googleapis.com') | 221 'DIRECTORY_API_HOST', 'https://www.googleapis.com') |
230 remotingApiHost = os.environ.get( | 222 remotingApiHost = os.environ.get( |
231 'REMOTING_API_HOST', 'https://remoting-pa.googleapis.com') | 223 'REMOTING_API_HOST', 'https://remoting-pa.googleapis.com') |
232 | 224 |
233 if is_app_remoting: | |
234 appRemotingApiHost = os.environ.get( | |
235 'APP_REMOTING_API_HOST', None) | |
236 | |
237 if is_app_remoting_webapp: | |
238 appRemotingApplicationId = os.environ.get( | |
239 'APP_REMOTING_APPLICATION_ID', None) | |
240 | |
241 # Release/Official builds are special because they are what we will upload | |
242 # to the web store. The checks below will validate that prod builds are | |
243 # being generated correctly (no overrides) and with the correct buildtype. | |
244 # They also verify that folks are not accidentally building dev apps for | |
245 # Release (no impersonation) instead of Dev. | |
246 if is_prod_service_environment and buildtype == 'Dev': | |
247 raise Exception("Prod environment cannot be built for 'dev' builds") | |
248 | |
249 if buildtype != 'Dev': | |
250 if not is_prod_service_environment: | |
251 raise Exception('Invalid service_environment targeted for ' | |
252 + buildtype + ': ' + service_environment) | |
253 if appid != None: | |
254 raise Exception('Cannot pass in an appid for ' | |
255 + buildtype + ' builds: ' + service_environment) | |
256 if appRemotingApiHost != None: | |
257 raise Exception('Cannot set APP_REMOTING_API_HOST env var for ' | |
258 + buildtype + ' builds') | |
259 if appRemotingApplicationId != None: | |
260 raise Exception('Cannot set APP_REMOTING_APPLICATION_ID env var for ' | |
261 + buildtype + ' builds') | |
262 | |
263 # If an Application ID was set (either from service_environment variable or | |
264 # from a command line argument), hardcode it, otherwise get it at runtime. | |
265 effectiveAppId = appRemotingApplicationId or appid | |
266 if effectiveAppId: | |
267 appRemotingApplicationId = "'" + effectiveAppId + "'" | |
268 else: | |
269 appRemotingApplicationId = "chrome.i18n.getMessage('@@extension_id')" | |
270 findAndReplace(os.path.join(destination, 'arv_main.js'), | |
271 "'APP_REMOTING_APPLICATION_ID'", appRemotingApplicationId) | |
272 | |
273 oauth2BaseUrl = oauth2AccountsHost + '/o/oauth2' | 225 oauth2BaseUrl = oauth2AccountsHost + '/o/oauth2' |
274 oauth2ApiBaseUrl = oauth2ApiHost + '/oauth2' | 226 oauth2ApiBaseUrl = oauth2ApiHost + '/oauth2' |
275 directoryApiBaseUrl = directoryApiHost + '/chromoting/v1' | 227 directoryApiBaseUrl = directoryApiHost + '/chromoting/v1' |
276 telemetryApiBaseUrl = remotingApiHost + '/v1/events' | 228 telemetryApiBaseUrl = remotingApiHost + '/v1/events' |
277 | 229 |
278 if is_app_remoting: | 230 replaceBool(destination, 'USE_GCD', use_gcd) |
279 # Set the base endpoint url first and then set the endpoint version. | 231 replaceString(destination, 'OAUTH2_BASE_URL', oauth2BaseUrl) |
280 if not appRemotingApiHost: | 232 replaceString(destination, 'OAUTH2_API_BASE_URL', oauth2ApiBaseUrl) |
281 if is_prod_service_environment: | 233 replaceString(destination, 'DIRECTORY_API_BASE_URL', directoryApiBaseUrl) |
282 appRemotingApiHost = 'https://www.googleapis.com' | 234 replaceString(destination, 'TELEMETRY_API_BASE_URL', telemetryApiBaseUrl) |
283 else: | |
284 appRemotingApiHost = 'https://www-googleapis-test.sandbox.google.com' | |
285 | |
286 # TODO(garykac) Currently, the shared module is always set up for the | |
287 # dev service_environment. Update build so that the dev environment can | |
288 # be controlled by the app stub rather than hard-coded into the shared | |
289 # module. | |
290 if service_environment == 'dev' or is_app_remoting_shared_module: | |
291 appRemotingServicePath = '/appremoting/v1beta1_dev' | |
292 elif service_environment == 'prod': | |
293 appRemotingServicePath = '/appremoting/v1beta1' | |
294 else: | |
295 raise Exception('Unknown service environment: ' + service_environment) | |
296 appRemotingApiBaseUrl = appRemotingApiHost + appRemotingServicePath | |
297 else: | |
298 appRemotingApiBaseUrl = '' | |
299 | |
300 # TODO(garykac) replaceString (et al.) implictly update plugin_settings.js, | |
301 # which doesn't exist for the app stub. We need to move app-specific | |
302 # AppRemoting options into arv_main.js. | |
303 if not is_app_remoting_webapp: | |
304 replaceBool(destination, 'USE_GCD', use_gcd) | |
305 replaceString(destination, 'OAUTH2_BASE_URL', oauth2BaseUrl) | |
306 replaceString(destination, 'OAUTH2_API_BASE_URL', oauth2ApiBaseUrl) | |
307 replaceString(destination, 'DIRECTORY_API_BASE_URL', directoryApiBaseUrl) | |
308 replaceString(destination, 'TELEMETRY_API_BASE_URL', telemetryApiBaseUrl) | |
309 if is_app_remoting: | |
310 replaceString(destination, 'APP_REMOTING_API_BASE_URL', | |
311 appRemotingApiBaseUrl) | |
312 | 235 |
313 # Substitute hosts in the manifest's CSP list. | 236 # Substitute hosts in the manifest's CSP list. |
314 # Ensure we list the API host only once if it's the same for multiple APIs. | 237 # Ensure we list the API host only once if it's the same for multiple APIs. |
315 googleApiHosts = ' '.join(set([oauth2ApiHost, directoryApiHost])) | 238 googleApiHosts = ' '.join(set([oauth2ApiHost, directoryApiHost])) |
316 | 239 |
317 # WCS and the OAuth trampoline are both hosted on talkgadget. Split them into | 240 # WCS and the OAuth trampoline are both hosted on talkgadget. Split them into |
318 # separate suffix/prefix variables to allow for wildcards in manifest.json. | 241 # separate suffix/prefix variables to allow for wildcards in manifest.json. |
319 talkGadgetHostSuffix = os.environ.get( | 242 talkGadgetHostSuffix = os.environ.get( |
320 'TALK_GADGET_HOST_SUFFIX', 'talkgadget.google.com') | 243 'TALK_GADGET_HOST_SUFFIX', 'talkgadget.google.com') |
321 talkGadgetHostPrefix = os.environ.get( | 244 talkGadgetHostPrefix = os.environ.get( |
(...skipping 19 matching lines...) Expand all Loading... |
341 oauth2RedirectUrlJs = ("'" + oauth2RedirectBaseUrlJs + | 264 oauth2RedirectUrlJs = ("'" + oauth2RedirectBaseUrlJs + |
342 "/rel/' + chrome.i18n.getMessage('@@extension_id')") | 265 "/rel/' + chrome.i18n.getMessage('@@extension_id')") |
343 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/rel/*' | 266 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/rel/*' |
344 else: | 267 else: |
345 oauth2RedirectUrlJs = "'" + oauth2RedirectBaseUrlJs + "/dev'" | 268 oauth2RedirectUrlJs = "'" + oauth2RedirectBaseUrlJs + "/dev'" |
346 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/dev*' | 269 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/dev*' |
347 thirdPartyAuthUrlJs = oauth2RedirectBaseUrlJs + '/thirdpartyauth' | 270 thirdPartyAuthUrlJs = oauth2RedirectBaseUrlJs + '/thirdpartyauth' |
348 thirdPartyAuthUrlJson = oauth2RedirectBaseUrlJson + '/thirdpartyauth*' | 271 thirdPartyAuthUrlJson = oauth2RedirectBaseUrlJson + '/thirdpartyauth*' |
349 xmppServer = os.environ.get('XMPP_SERVER', 'talk.google.com:443') | 272 xmppServer = os.environ.get('XMPP_SERVER', 'talk.google.com:443') |
350 | 273 |
351 if not is_app_remoting_webapp: | 274 replaceString(destination, 'TALK_GADGET_URL', talkGadgetBaseUrl) |
352 replaceString(destination, 'TALK_GADGET_URL', talkGadgetBaseUrl) | 275 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
353 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 276 "'OAUTH2_REDIRECT_URL'", oauth2RedirectUrlJs) |
354 "'OAUTH2_REDIRECT_URL'", oauth2RedirectUrlJs) | |
355 | 277 |
356 # Configure xmpp server and directory bot settings in the plugin. | 278 # Configure xmpp server and directory bot settings in the plugin. |
357 xmpp_server_user_tls = getenvBool('XMPP_SERVER_USE_TLS', True) | 279 xmpp_server_user_tls = getenvBool('XMPP_SERVER_USE_TLS', True) |
358 if (buildtype != 'Dev' and not xmpp_server_user_tls): | 280 if (buildtype != 'Dev' and not xmpp_server_user_tls): |
359 raise Exception('TLS can must be enabled in non Dev builds.') | 281 raise Exception('TLS can must be enabled in non Dev builds.') |
360 | 282 |
361 replaceBool( | 283 replaceBool( |
362 destination, 'XMPP_SERVER_USE_TLS', xmpp_server_user_tls) | 284 destination, 'XMPP_SERVER_USE_TLS', xmpp_server_user_tls) |
363 replaceString(destination, 'XMPP_SERVER', xmppServer) | 285 replaceString(destination, 'XMPP_SERVER', xmppServer) |
364 replaceString(destination, 'DIRECTORY_BOT_JID', | 286 replaceString(destination, 'DIRECTORY_BOT_JID', |
365 os.environ.get('DIRECTORY_BOT_JID', | 287 os.environ.get('DIRECTORY_BOT_JID', |
366 'remoting@bot.talk.google.com')) | 288 'remoting@bot.talk.google.com')) |
367 replaceString(destination, 'THIRD_PARTY_AUTH_REDIRECT_URL', | 289 replaceString(destination, 'THIRD_PARTY_AUTH_REDIRECT_URL', |
368 thirdPartyAuthUrlJs) | 290 thirdPartyAuthUrlJs) |
369 | 291 |
370 # Set the correct API keys. | 292 # Set the correct API keys. |
371 # For overriding the client ID/secret via env vars, see google_api_keys.py. | 293 # For overriding the client ID/secret via env vars, see google_api_keys.py. |
372 apiClientId = google_api_keys.GetClientID('REMOTING') | 294 apiClientId = google_api_keys.GetClientID('REMOTING') |
373 apiClientSecret = google_api_keys.GetClientSecret('REMOTING') | 295 apiClientSecret = google_api_keys.GetClientSecret('REMOTING') |
374 apiKey = google_api_keys.GetAPIKeyRemoting() | 296 apiKey = google_api_keys.GetAPIKeyRemoting() |
375 | 297 |
376 if is_app_remoting_webapp and buildtype != 'Dev': | 298 apiClientIdV2 = os.environ.get( |
377 if not app_client_id: | 299 'REMOTING_IDENTITY_API_CLIENT_ID', |
378 raise Exception('Invalid app_client_id passed in: "' + | 300 google_api_keys.GetClientID('REMOTING_IDENTITY_API')) |
379 app_client_id + '"') | |
380 apiClientIdV2 = app_client_id + '.apps.googleusercontent.com' | |
381 else: | |
382 apiClientIdV2 = os.environ.get( | |
383 'REMOTING_IDENTITY_API_CLIENT_ID', | |
384 google_api_keys.GetClientID('REMOTING_IDENTITY_API')) | |
385 | 301 |
386 if not is_app_remoting_webapp: | 302 replaceString(destination, 'API_CLIENT_ID', apiClientId) |
387 replaceString(destination, 'API_CLIENT_ID', apiClientId) | 303 replaceString(destination, 'API_CLIENT_SECRET', apiClientSecret) |
388 replaceString(destination, 'API_CLIENT_SECRET', apiClientSecret) | 304 replaceString(destination, 'API_KEY', apiKey) |
389 replaceString(destination, 'API_KEY', apiKey) | |
390 | 305 |
391 # Write the application capabilities. | 306 # Use a fixed key in the app manifest. For dev builds, this ensures that the |
392 if is_app_remoting_webapp: | 307 # app can be run directly from the output directory. For official CRD builds, |
393 appCapabilities = ','.join( | |
394 ['remoting.ClientSession.Capability.' + x for x in app_capabilities]) | |
395 findAndReplace(os.path.join(destination, 'arv_main.js'), | |
396 "'APPLICATION_CAPABILITIES'", appCapabilities) | |
397 | |
398 # Official AppRemoting builds get the key from the gyp/gn build file. All | |
399 # other builds use a fixed key. For dev builds, this ensures that the app | |
400 # can be run directly from the output directory. For official CRD builds, | |
401 # it allows QA to test the app without uploading it to Chrome Web Store. | 308 # it allows QA to test the app without uploading it to Chrome Web Store. |
402 if is_app_remoting_webapp and buildtype != 'Dev': | 309 manifest_key = 'remotingdevbuild' |
403 if not manifest_key: | |
404 raise Exception('No manifest_key passed in') | |
405 else: | |
406 manifest_key = 'remotingdevbuild' | |
407 | 310 |
408 # Generate manifest. | 311 # Generate manifest. |
409 if manifest_template: | 312 if manifest_template: |
410 context = { | 313 context = { |
411 'webapp_type': webapp_type, | |
412 'FULL_APP_VERSION': version, | 314 'FULL_APP_VERSION': version, |
413 'MANIFEST_KEY': manifest_key, | 315 'MANIFEST_KEY': manifest_key, |
414 'OAUTH2_REDIRECT_URL': oauth2RedirectUrlJson, | 316 'OAUTH2_REDIRECT_URL': oauth2RedirectUrlJson, |
415 'TALK_GADGET_HOST': talkGadgetHostJson, | 317 'TALK_GADGET_HOST': talkGadgetHostJson, |
416 'THIRD_PARTY_AUTH_REDIRECT_URL': thirdPartyAuthUrlJson, | 318 'THIRD_PARTY_AUTH_REDIRECT_URL': thirdPartyAuthUrlJson, |
417 'REMOTING_IDENTITY_API_CLIENT_ID': apiClientIdV2, | 319 'REMOTING_IDENTITY_API_CLIENT_ID': apiClientIdV2, |
418 'OAUTH2_BASE_URL': oauth2BaseUrl, | 320 'OAUTH2_BASE_URL': oauth2BaseUrl, |
419 'OAUTH2_API_BASE_URL': oauth2ApiBaseUrl, | 321 'OAUTH2_API_BASE_URL': oauth2ApiBaseUrl, |
420 'DIRECTORY_API_BASE_URL': directoryApiBaseUrl, | 322 'DIRECTORY_API_BASE_URL': directoryApiBaseUrl, |
421 'TELEMETRY_API_BASE_URL':telemetryApiBaseUrl , | 323 'TELEMETRY_API_BASE_URL':telemetryApiBaseUrl , |
422 'APP_REMOTING_API_BASE_URL': appRemotingApiBaseUrl, | |
423 'CLOUD_PRINT_URL': '', | 324 'CLOUD_PRINT_URL': '', |
424 'OAUTH2_ACCOUNTS_HOST': oauth2AccountsHost, | 325 'OAUTH2_ACCOUNTS_HOST': oauth2AccountsHost, |
425 'GOOGLE_API_HOSTS': googleApiHosts, | 326 'GOOGLE_API_HOSTS': googleApiHosts, |
426 'APP_NAME': app_name, | 327 'APP_NAME': app_name, |
427 'APP_DESCRIPTION': app_description, | 328 'APP_DESCRIPTION': app_description, |
428 'OAUTH_CLOUD_PRINT_SCOPE': '', | 329 'OAUTH_CLOUD_PRINT_SCOPE': '', |
429 'OAUTH_GDRIVE_SCOPE': '', | 330 'OAUTH_GDRIVE_SCOPE': '', |
430 'USE_GCD': use_gcd, | 331 'USE_GCD': use_gcd, |
431 'XMPP_SERVER': xmppServer, | 332 'XMPP_SERVER': xmppServer, |
432 # An URL match pattern that is added to the |permissions| section of the | 333 # An URL match pattern that is added to the |permissions| section of the |
(...skipping 17 matching lines...) Expand all Loading... |
450 return 0 | 351 return 0 |
451 | 352 |
452 | 353 |
453 def main(): | 354 def main(): |
454 parser = argparse.ArgumentParser() | 355 parser = argparse.ArgumentParser() |
455 parser.add_argument('buildtype') | 356 parser.add_argument('buildtype') |
456 parser.add_argument('version') | 357 parser.add_argument('version') |
457 parser.add_argument('destination') | 358 parser.add_argument('destination') |
458 parser.add_argument('zip_path') | 359 parser.add_argument('zip_path') |
459 parser.add_argument('manifest_template') | 360 parser.add_argument('manifest_template') |
460 parser.add_argument('webapp_type') | |
461 parser.add_argument('files', nargs='*', metavar='file', default=[]) | 361 parser.add_argument('files', nargs='*', metavar='file', default=[]) |
462 parser.add_argument('--app_name', metavar='NAME') | 362 parser.add_argument('--app_name', metavar='NAME') |
463 parser.add_argument('--app_description', metavar='TEXT') | 363 parser.add_argument('--app_description', metavar='TEXT') |
464 parser.add_argument('--app_capabilities', | 364 parser.add_argument('--app_capabilities', |
465 nargs='*', default=[], metavar='CAPABILITY') | 365 nargs='*', default=[], metavar='CAPABILITY') |
466 parser.add_argument('--appid') | 366 parser.add_argument('--appid') |
467 parser.add_argument('--app_client_id', default='') | 367 parser.add_argument('--app_client_id', default='') |
468 parser.add_argument('--manifest_key', default='') | 368 parser.add_argument('--manifest_key', default='') |
469 parser.add_argument('--files_listfile', default='', metavar='PATH') | 369 parser.add_argument('--files_listfile', default='', metavar='PATH') |
470 parser.add_argument('--locales_listfile', default='', metavar='PATH') | 370 parser.add_argument('--locales_listfile', default='', metavar='PATH') |
471 parser.add_argument('--jinja_paths', nargs='*', default=[], metavar='PATH') | 371 parser.add_argument('--jinja_paths', nargs='*', default=[], metavar='PATH') |
472 parser.add_argument('--service_environment', default='', metavar='ENV') | 372 parser.add_argument('--service_environment', default='', metavar='ENV') |
473 parser.add_argument('--use_gcd', choices=['0', '1'], default='0') | 373 parser.add_argument('--use_gcd', choices=['0', '1'], default='0') |
474 | 374 |
475 args = parser.parse_args() | 375 args = parser.parse_args() |
476 args.use_gcd = (args.use_gcd != '0') | 376 args.use_gcd = (args.use_gcd != '0') |
477 args.app_capabilities = set(args.app_capabilities) | 377 args.app_capabilities = set(args.app_capabilities) |
478 return buildWebApp(**vars(args)) | 378 return buildWebApp(**vars(args)) |
479 | 379 |
480 | 380 |
481 if __name__ == '__main__': | 381 if __name__ == '__main__': |
482 sys.exit(main()) | 382 sys.exit(main()) |
OLD | NEW |