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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 rel_path = os.path.relpath(full_path, directory) | 54 rel_path = os.path.relpath(full_path, directory) |
55 zip.write(full_path, os.path.join(zipfile_base, rel_path)) | 55 zip.write(full_path, os.path.join(zipfile_base, rel_path)) |
56 zip.close() | 56 zip.close() |
57 | 57 |
58 | 58 |
59 def replaceString(destination, placeholder, value): | 59 def replaceString(destination, placeholder, value): |
60 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 60 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
61 "'" + placeholder + "'", "'" + value + "'") | 61 "'" + placeholder + "'", "'" + value + "'") |
62 | 62 |
63 | 63 |
64 def processJinjaTemplate(input_file, output_file, context): | 64 def processJinjaTemplate(input_file, include_paths, output_file, context): |
65 jinja2_path = os.path.normpath( | 65 jinja2_path = os.path.normpath( |
66 os.path.join(os.path.abspath(__file__), | 66 os.path.join(os.path.abspath(__file__), |
67 '../../../third_party/jinja2')) | 67 '../../../third_party/jinja2')) |
68 sys.path.append(os.path.split(jinja2_path)[0]) | 68 sys.path.append(os.path.split(jinja2_path)[0]) |
69 import jinja2 | 69 import jinja2 |
70 (template_path, template_name) = os.path.split(input_file) | 70 (template_path, template_name) = os.path.split(input_file) |
71 env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_path)) | 71 include_paths = [template_path] + include_paths |
| 72 env = jinja2.Environment(loader=jinja2.FileSystemLoader(include_paths)) |
72 template = env.get_template(template_name) | 73 template = env.get_template(template_name) |
73 rendered = template.render(context) | 74 rendered = template.render(context) |
74 io.open(output_file, 'w', encoding='utf-8').write(rendered) | 75 io.open(output_file, 'w', encoding='utf-8').write(rendered) |
75 | 76 |
76 | 77 |
77 | |
78 def buildWebApp(buildtype, version, destination, zip_path, | 78 def buildWebApp(buildtype, version, destination, zip_path, |
79 manifest_template, webapp_type, files, locales): | 79 manifest_template, webapp_type, app_id, app_name, |
| 80 app_description, files, locales, jinja_paths, |
| 81 service_environment): |
80 """Does the main work of building the webapp directory and zipfile. | 82 """Does the main work of building the webapp directory and zipfile. |
81 | 83 |
82 Args: | 84 Args: |
83 buildtype: the type of build ("Official" or "Dev"). | 85 buildtype: the type of build ("Official", "Release" or "Dev"). |
84 destination: A string with path to directory where the webapp will be | 86 destination: A string with path to directory where the webapp will be |
85 written. | 87 written. |
86 zipfile: A string with path to the zipfile to create containing the | 88 zipfile: A string with path to the zipfile to create containing the |
87 contents of |destination|. | 89 contents of |destination|. |
88 manifest_template: jinja2 template file for manifest. | 90 manifest_template: jinja2 template file for manifest. |
89 webapp_type: webapp type ("v1", "v2" or "v2_pnacl"). | 91 webapp_type: webapp type ("v1", "v2", "v2_pnacl" or "app_remoting"). |
| 92 app_id: A string with the Remoting Application Id (only used for app |
| 93 remoting webapps). If supplied, it defaults to using the |
| 94 test API server. |
| 95 app_name: A string with the name of the application. |
| 96 app_description: A string with the description of the application. |
90 files: An array of strings listing the paths for resources to include | 97 files: An array of strings listing the paths for resources to include |
91 in this webapp. | 98 in this webapp. |
92 locales: An array of strings listing locales, which are copied, along | 99 locales: An array of strings listing locales, which are copied, along |
93 with their directory structure from the _locales directory down. | 100 with their directory structure from the _locales directory down. |
| 101 jinja_paths: An array of paths to search for {%include} directives in |
| 102 addition to the directory containing the manifest template. |
| 103 service_environment: Used to point the webApp to one of the |
| 104 dev/test/staging/prod environments |
94 """ | 105 """ |
95 # Ensure a fresh directory. | 106 # Ensure a fresh directory. |
96 try: | 107 try: |
97 shutil.rmtree(destination) | 108 shutil.rmtree(destination) |
98 except OSError: | 109 except OSError: |
99 if os.path.exists(destination): | 110 if os.path.exists(destination): |
100 raise | 111 raise |
101 else: | 112 else: |
102 pass | 113 pass |
103 os.mkdir(destination, 0775) | 114 os.mkdir(destination, 0775) |
104 | 115 |
| 116 if buildtype != "Official" and buildtype != "Release" and buildtype != "Dev": |
| 117 raise Exception("Unknown buildtype: " + buildtype); |
| 118 |
105 # Use symlinks on linux and mac for faster compile/edit cycle. | 119 # Use symlinks on linux and mac for faster compile/edit cycle. |
106 # | 120 # |
107 # On Windows Vista platform.system() can return 'Microsoft' with some | 121 # On Windows Vista platform.system() can return 'Microsoft' with some |
108 # versions of Python, see http://bugs.python.org/issue1082 | 122 # versions of Python, see http://bugs.python.org/issue1082 |
109 # should_symlink = platform.system() not in ['Windows', 'Microsoft'] | 123 # should_symlink = platform.system() not in ['Windows', 'Microsoft'] |
110 # | 124 # |
111 # TODO(ajwong): Pending decision on http://crbug.com/27185 we may not be | 125 # TODO(ajwong): Pending decision on http://crbug.com/27185 we may not be |
112 # able to load symlinked resources. | 126 # able to load symlinked resources. |
113 should_symlink = False | 127 should_symlink = False |
114 | 128 |
(...skipping 28 matching lines...) Expand all Loading... |
143 os.mkdir(destination_dir, 0775) | 157 os.mkdir(destination_dir, 0775) |
144 shutil.copy2(current_locale, destination_file) | 158 shutil.copy2(current_locale, destination_file) |
145 elif extension == '.pak': | 159 elif extension == '.pak': |
146 destination_file = os.path.join(remoting_locales, | 160 destination_file = os.path.join(remoting_locales, |
147 os.path.split(current_locale)[1]) | 161 os.path.split(current_locale)[1]) |
148 shutil.copy2(current_locale, destination_file) | 162 shutil.copy2(current_locale, destination_file) |
149 else: | 163 else: |
150 raise Exception("Unknown extension: " + current_locale); | 164 raise Exception("Unknown extension: " + current_locale); |
151 | 165 |
152 # Set client plugin type. | 166 # Set client plugin type. |
| 167 # TODO(wez): Use 'native' in app_remoting until b/17441659 is resolved. |
153 client_plugin = 'pnacl' if webapp_type == 'v2_pnacl' else 'native' | 168 client_plugin = 'pnacl' if webapp_type == 'v2_pnacl' else 'native' |
154 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 169 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
155 "'CLIENT_PLUGIN_TYPE'", "'" + client_plugin + "'") | 170 "'CLIENT_PLUGIN_TYPE'", "'" + client_plugin + "'") |
156 | 171 |
157 # Allow host names for google services/apis to be overriden via env vars. | 172 # Allow host names for google services/apis to be overriden via env vars. |
158 oauth2AccountsHost = os.environ.get( | 173 oauth2AccountsHost = os.environ.get( |
159 'OAUTH2_ACCOUNTS_HOST', 'https://accounts.google.com') | 174 'OAUTH2_ACCOUNTS_HOST', 'https://accounts.google.com') |
160 oauth2ApiHost = os.environ.get( | 175 oauth2ApiHost = os.environ.get( |
161 'OAUTH2_API_HOST', 'https://www.googleapis.com') | 176 'OAUTH2_API_HOST', 'https://www.googleapis.com') |
162 directoryApiHost = os.environ.get( | 177 directoryApiHost = os.environ.get( |
163 'DIRECTORY_API_HOST', 'https://www.googleapis.com') | 178 'DIRECTORY_API_HOST', 'https://www.googleapis.com') |
| 179 |
| 180 if webapp_type == 'app_remoting': |
| 181 appRemotingApiHost = os.environ.get( |
| 182 'APP_REMOTING_API_HOST', None) |
| 183 appRemotingApplicationId = os.environ.get( |
| 184 'APP_REMOTING_APPLICATION_ID', None) |
| 185 |
| 186 # Release/Official builds are special because they are what we will upload |
| 187 # to the web store. The checks below will validate that prod builds are |
| 188 # being generated correctly (no overrides) and with the correct buildtype. |
| 189 # They also verify that folks are not accidentally building dev/test/staging |
| 190 # apps for release (no impersonation) instead of dev. |
| 191 if service_environment == "prod" and buildtype == "Dev": |
| 192 raise Exception("Prod environment cannot be built for 'dev' builds"); |
| 193 |
| 194 if buildtype != "Dev": |
| 195 if service_environment != "prod": |
| 196 raise Exception("Invalid service_environment targeted for " |
| 197 + buildtype + ": " + service_environment); |
| 198 if "out/Release" not in destination: |
| 199 raise Exception("Prod builds must be placed in the out/Release folder"); |
| 200 if app_id != None: |
| 201 raise Exception("Cannot pass in an app_id for " |
| 202 + buildtype + " builds: " + service_environment); |
| 203 if appRemotingApiHost != None: |
| 204 raise Exception("Cannot set APP_REMOTING_API_HOST env var for " |
| 205 + buildtype + " builds"); |
| 206 if appRemotingApplicationId != None: |
| 207 raise Exception("Cannot set APP_REMOTING_APPLICATION_ID env var for " |
| 208 + buildtype + " builds"); |
| 209 |
| 210 # If an Application ID was set (either from service_environment variable or |
| 211 # from a command line argument), hardcode it, otherwise get it at runtime. |
| 212 effectiveAppId = appRemotingApplicationId or app_id |
| 213 if effectiveAppId: |
| 214 appRemotingApplicationId = "'" + effectiveAppId + "'" |
| 215 else: |
| 216 appRemotingApplicationId = "chrome.i18n.getMessage('@@extension_id')" |
| 217 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
| 218 "'APP_REMOTING_APPLICATION_ID'", appRemotingApplicationId) |
| 219 |
164 oauth2BaseUrl = oauth2AccountsHost + '/o/oauth2' | 220 oauth2BaseUrl = oauth2AccountsHost + '/o/oauth2' |
165 oauth2ApiBaseUrl = oauth2ApiHost + '/oauth2' | 221 oauth2ApiBaseUrl = oauth2ApiHost + '/oauth2' |
166 directoryApiBaseUrl = directoryApiHost + '/chromoting/v1' | 222 directoryApiBaseUrl = directoryApiHost + '/chromoting/v1' |
| 223 |
| 224 if webapp_type == 'app_remoting': |
| 225 # Set the apiary endpoint and then set the endpoint version |
| 226 if not appRemotingApiHost: |
| 227 if service_environment == "prod": |
| 228 appRemotingApiHost = 'https://www.googleapis.com' |
| 229 else: |
| 230 appRemotingApiHost = 'https://www-googleapis-test.sandbox.google.com' |
| 231 |
| 232 if service_environment == "dev": |
| 233 appRemotingServicePath = '/appremoting/v1beta1_dev' |
| 234 elif service_environment == "test": |
| 235 appRemotingServicePath = '/appremoting/v1beta1' |
| 236 elif service_environment == "staging": |
| 237 appRemotingServicePath = '/appremoting/v1beta1_staging' |
| 238 elif service_environment == "prod": |
| 239 appRemotingServicePath = '/appremoting/v1beta1' |
| 240 else: |
| 241 raise Exception("Unknown service environment: " + service_environment); |
| 242 appRemotingApiBaseUrl = appRemotingApiHost + appRemotingServicePath |
| 243 else: |
| 244 appRemotingApiBaseUrl = '' |
| 245 |
167 replaceString(destination, 'OAUTH2_BASE_URL', oauth2BaseUrl) | 246 replaceString(destination, 'OAUTH2_BASE_URL', oauth2BaseUrl) |
168 replaceString(destination, 'OAUTH2_API_BASE_URL', oauth2ApiBaseUrl) | 247 replaceString(destination, 'OAUTH2_API_BASE_URL', oauth2ApiBaseUrl) |
169 replaceString(destination, 'DIRECTORY_API_BASE_URL', directoryApiBaseUrl) | 248 replaceString(destination, 'DIRECTORY_API_BASE_URL', directoryApiBaseUrl) |
| 249 if webapp_type == 'app_remoting': |
| 250 replaceString(destination, 'APP_REMOTING_API_BASE_URL', |
| 251 appRemotingApiBaseUrl) |
| 252 |
170 # Substitute hosts in the manifest's CSP list. | 253 # Substitute hosts in the manifest's CSP list. |
171 # Ensure we list the API host only once if it's the same for multiple APIs. | 254 # Ensure we list the API host only once if it's the same for multiple APIs. |
172 googleApiHosts = ' '.join(set([oauth2ApiHost, directoryApiHost])) | 255 googleApiHosts = ' '.join(set([oauth2ApiHost, directoryApiHost])) |
173 | 256 |
174 # WCS and the OAuth trampoline are both hosted on talkgadget. Split them into | 257 # WCS and the OAuth trampoline are both hosted on talkgadget. Split them into |
175 # separate suffix/prefix variables to allow for wildcards in manifest.json. | 258 # separate suffix/prefix variables to allow for wildcards in manifest.json. |
176 talkGadgetHostSuffix = os.environ.get( | 259 talkGadgetHostSuffix = os.environ.get( |
177 'TALK_GADGET_HOST_SUFFIX', 'talkgadget.google.com') | 260 'TALK_GADGET_HOST_SUFFIX', 'talkgadget.google.com') |
178 talkGadgetHostPrefix = os.environ.get( | 261 talkGadgetHostPrefix = os.environ.get( |
179 'TALK_GADGET_HOST_PREFIX', 'https://chromoting-client.') | 262 'TALK_GADGET_HOST_PREFIX', 'https://chromoting-client.') |
180 oauth2RedirectHostPrefix = os.environ.get( | 263 oauth2RedirectHostPrefix = os.environ.get( |
181 'OAUTH2_REDIRECT_HOST_PREFIX', 'https://chromoting-oauth.') | 264 'OAUTH2_REDIRECT_HOST_PREFIX', 'https://chromoting-oauth.') |
182 | 265 |
183 # Use a wildcard in the manifest.json host specs if the prefixes differ. | 266 # Use a wildcard in the manifest.json host specs if the prefixes differ. |
184 talkGadgetHostJs = talkGadgetHostPrefix + talkGadgetHostSuffix | 267 talkGadgetHostJs = talkGadgetHostPrefix + talkGadgetHostSuffix |
185 talkGadgetBaseUrl = talkGadgetHostJs + '/talkgadget/' | 268 talkGadgetBaseUrl = talkGadgetHostJs + '/talkgadget/' |
186 if talkGadgetHostPrefix == oauth2RedirectHostPrefix: | 269 if talkGadgetHostPrefix == oauth2RedirectHostPrefix: |
187 talkGadgetHostJson = talkGadgetHostJs | 270 talkGadgetHostJson = talkGadgetHostJs |
188 else: | 271 else: |
189 talkGadgetHostJson = 'https://*.' + talkGadgetHostSuffix | 272 talkGadgetHostJson = 'https://*.' + talkGadgetHostSuffix |
190 | 273 |
191 # Set the correct OAuth2 redirect URL. | 274 # Set the correct OAuth2 redirect URL. |
192 oauth2RedirectHostJs = oauth2RedirectHostPrefix + talkGadgetHostSuffix | 275 oauth2RedirectHostJs = oauth2RedirectHostPrefix + talkGadgetHostSuffix |
193 oauth2RedirectHostJson = talkGadgetHostJson | 276 oauth2RedirectHostJson = talkGadgetHostJson |
194 oauth2RedirectPath = '/talkgadget/oauth/chrome-remote-desktop' | 277 oauth2RedirectPath = '/talkgadget/oauth/chrome-remote-desktop' |
195 oauth2RedirectBaseUrlJs = oauth2RedirectHostJs + oauth2RedirectPath | 278 oauth2RedirectBaseUrlJs = oauth2RedirectHostJs + oauth2RedirectPath |
196 oauth2RedirectBaseUrlJson = oauth2RedirectHostJson + oauth2RedirectPath | 279 oauth2RedirectBaseUrlJson = oauth2RedirectHostJson + oauth2RedirectPath |
197 if buildtype == 'Official': | 280 if buildtype != 'Dev': |
198 oauth2RedirectUrlJs = ("'" + oauth2RedirectBaseUrlJs + | 281 oauth2RedirectUrlJs = ("'" + oauth2RedirectBaseUrlJs + |
199 "/rel/' + chrome.i18n.getMessage('@@extension_id')") | 282 "/rel/' + chrome.i18n.getMessage('@@extension_id')") |
200 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/rel/*' | 283 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/rel/*' |
201 else: | 284 else: |
202 oauth2RedirectUrlJs = "'" + oauth2RedirectBaseUrlJs + "/dev'" | 285 oauth2RedirectUrlJs = "'" + oauth2RedirectBaseUrlJs + "/dev'" |
203 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/dev*' | 286 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/dev*' |
204 thirdPartyAuthUrlJs = oauth2RedirectBaseUrlJs + "/thirdpartyauth" | 287 thirdPartyAuthUrlJs = oauth2RedirectBaseUrlJs + "/thirdpartyauth" |
205 thirdPartyAuthUrlJson = oauth2RedirectBaseUrlJson + '/thirdpartyauth*' | 288 thirdPartyAuthUrlJson = oauth2RedirectBaseUrlJson + '/thirdpartyauth*' |
206 replaceString(destination, "TALK_GADGET_URL", talkGadgetBaseUrl) | 289 replaceString(destination, "TALK_GADGET_URL", talkGadgetBaseUrl) |
207 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 290 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
(...skipping 15 matching lines...) Expand all Loading... |
223 | 306 |
224 # Set the correct API keys. | 307 # Set the correct API keys. |
225 # For overriding the client ID/secret via env vars, see google_api_keys.py. | 308 # For overriding the client ID/secret via env vars, see google_api_keys.py. |
226 apiClientId = google_api_keys.GetClientID('REMOTING') | 309 apiClientId = google_api_keys.GetClientID('REMOTING') |
227 apiClientSecret = google_api_keys.GetClientSecret('REMOTING') | 310 apiClientSecret = google_api_keys.GetClientSecret('REMOTING') |
228 apiClientIdV2 = google_api_keys.GetClientID('REMOTING_IDENTITY_API') | 311 apiClientIdV2 = google_api_keys.GetClientID('REMOTING_IDENTITY_API') |
229 | 312 |
230 replaceString(destination, "API_CLIENT_ID", apiClientId) | 313 replaceString(destination, "API_CLIENT_ID", apiClientId) |
231 replaceString(destination, "API_CLIENT_SECRET", apiClientSecret) | 314 replaceString(destination, "API_CLIENT_SECRET", apiClientSecret) |
232 | 315 |
233 # Use a consistent extension id for unofficial builds. | 316 # Use a consistent extension id for dev builds. |
234 if buildtype != 'Official': | 317 if buildtype == 'Dev': |
235 manifestKey = '"key": "remotingdevbuild",' | 318 manifestKey = '"key": "remotingdevbuild",' |
236 else: | 319 else: |
237 manifestKey = '' | 320 manifestKey = '' |
238 | 321 |
239 # Generate manifest. | 322 # Generate manifest. |
240 context = { | 323 if manifest_template: |
241 'webapp_type': webapp_type, | 324 context = { |
242 'FULL_APP_VERSION': version, | 325 'webapp_type': webapp_type, |
243 'MANIFEST_KEY_FOR_UNOFFICIAL_BUILD': manifestKey, | 326 'FULL_APP_VERSION': version, |
244 'OAUTH2_REDIRECT_URL': oauth2RedirectUrlJson, | 327 'MANIFEST_KEY_FOR_UNOFFICIAL_BUILD': manifestKey, |
245 'TALK_GADGET_HOST': talkGadgetHostJson, | 328 'OAUTH2_REDIRECT_URL': oauth2RedirectUrlJson, |
246 'THIRD_PARTY_AUTH_REDIRECT_URL': thirdPartyAuthUrlJson, | 329 'TALK_GADGET_HOST': talkGadgetHostJson, |
247 'REMOTING_IDENTITY_API_CLIENT_ID': apiClientIdV2, | 330 'THIRD_PARTY_AUTH_REDIRECT_URL': thirdPartyAuthUrlJson, |
248 'OAUTH2_BASE_URL': oauth2BaseUrl, | 331 'REMOTING_IDENTITY_API_CLIENT_ID': apiClientIdV2, |
249 'OAUTH2_API_BASE_URL': oauth2ApiBaseUrl, | 332 'OAUTH2_BASE_URL': oauth2BaseUrl, |
250 'DIRECTORY_API_BASE_URL': directoryApiBaseUrl, | 333 'OAUTH2_API_BASE_URL': oauth2ApiBaseUrl, |
251 'OAUTH2_ACCOUNTS_HOST': oauth2AccountsHost, | 334 'DIRECTORY_API_BASE_URL': directoryApiBaseUrl, |
252 'GOOGLE_API_HOSTS': googleApiHosts, | 335 'APP_REMOTING_API_BASE_URL': appRemotingApiBaseUrl, |
253 } | 336 'OAUTH2_ACCOUNTS_HOST': oauth2AccountsHost, |
254 processJinjaTemplate(manifest_template, | 337 'GOOGLE_API_HOSTS': googleApiHosts, |
255 os.path.join(destination, 'manifest.json'), | 338 'APP_NAME': app_name, |
256 context) | 339 'APP_DESCRIPTION': app_description, |
| 340 } |
| 341 processJinjaTemplate(manifest_template, |
| 342 jinja_paths, |
| 343 os.path.join(destination, 'manifest.json'), |
| 344 context) |
257 | 345 |
258 # Make the zipfile. | 346 # Make the zipfile. |
259 createZip(zip_path, destination) | 347 createZip(zip_path, destination) |
260 | 348 |
261 return 0 | 349 return 0 |
262 | 350 |
263 | 351 |
264 def main(): | 352 def main(): |
265 if len(sys.argv) < 6: | 353 if len(sys.argv) < 6: |
266 print ('Usage: build-webapp.py ' | 354 print ('Usage: build-webapp.py ' |
267 '<build-type> <version> <dst> <zip-path> <manifest_template> ' | 355 '<build-type> <version> <dst> <zip-path> <manifest_template> ' |
268 '<webapp_type> <other files...> ' | 356 '<webapp_type> <other files...> ' |
269 '[--locales <locales...>]') | 357 '--app_name <name> ' |
| 358 '--app_description <description> ' |
| 359 '[--appid <appid>] ' |
| 360 '[--locales <locales...>] ' |
| 361 '[--jinja_paths <paths...>] ' |
| 362 '[--service_environment <service_environment>]') |
270 return 1 | 363 return 1 |
271 | 364 |
272 arg_type = '' | 365 arg_type = '' |
273 files = [] | 366 files = [] |
274 locales = [] | 367 locales = [] |
| 368 jinja_paths = [] |
| 369 app_id = None |
| 370 app_name = None |
| 371 app_description = None |
| 372 service_environment = '' |
| 373 |
275 for arg in sys.argv[7:]: | 374 for arg in sys.argv[7:]: |
276 if arg in ['--locales']: | 375 if arg in ['--locales', |
| 376 '--jinja_paths', |
| 377 '--appid', |
| 378 '--app_name', |
| 379 '--app_description', |
| 380 '--service_environment']: |
277 arg_type = arg | 381 arg_type = arg |
278 elif arg_type == '--locales': | 382 elif arg_type == '--locales': |
279 locales.append(arg) | 383 locales.append(arg) |
| 384 elif arg_type == '--jinja_paths': |
| 385 jinja_paths.append(arg) |
| 386 elif arg_type == '--appid': |
| 387 app_id = arg |
| 388 arg_type = '' |
| 389 elif arg_type == '--app_name': |
| 390 app_name = arg |
| 391 arg_type = '' |
| 392 elif arg_type == '--app_description': |
| 393 app_description = arg |
| 394 arg_type = '' |
| 395 elif arg_type == '--service_environment': |
| 396 service_environment = arg |
| 397 arg_type = '' |
280 else: | 398 else: |
281 files.append(arg) | 399 files.append(arg) |
282 | 400 |
283 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], | 401 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], |
284 sys.argv[5], sys.argv[6], files, locales) | 402 sys.argv[5], sys.argv[6], app_id, app_name, |
| 403 app_description, files, locales, jinja_paths, |
| 404 service_environment) |
285 | 405 |
286 | 406 |
287 if __name__ == '__main__': | 407 if __name__ == '__main__': |
288 sys.exit(main()) | 408 sys.exit(main()) |
OLD | NEW |