| OLD | NEW |
| 1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
| 2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 import sys | 6 import sys |
| 7 import re | 7 import re |
| 8 import subprocess | 8 import subprocess |
| 9 import shutil | 9 import shutil |
| 10 import buildtools | 10 import buildtools |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 zip_file.extractall(devenv_dir) | 245 zip_file.extractall(devenv_dir) |
| 246 | 246 |
| 247 | 247 |
| 248 def readLocaleConfig(baseDir, type, metadata): | 248 def readLocaleConfig(baseDir, type, metadata): |
| 249 if type == 'gecko': | 249 if type == 'gecko': |
| 250 import buildtools.packagerGecko as packager | 250 import buildtools.packagerGecko as packager |
| 251 localeDir = packager.getLocalesDir(baseDir) | 251 localeDir = packager.getLocalesDir(baseDir) |
| 252 localeConfig = { | 252 localeConfig = { |
| 253 'name_format': 'BCP-47', | 253 'name_format': 'BCP-47', |
| 254 'file_format': 'gecko-dtd', | 254 'file_format': 'gecko-dtd', |
| 255 'target_platforms': {'gecko'}, | |
| 256 'default_locale': packager.defaultLocale | 255 'default_locale': packager.defaultLocale |
| 257 } | 256 } |
| 258 elif type in {'chrome', 'gecko-webext'}: | 257 elif type in {'chrome', 'gecko-webext'}: |
| 259 import buildtools.packagerChrome as packager | 258 import buildtools.packagerChrome as packager |
| 260 localeDir = os.path.join(baseDir, '_locales') | 259 localeDir = os.path.join(baseDir, '_locales') |
| 261 localeConfig = { | 260 localeConfig = { |
| 262 'name_format': 'ISO-15897', | 261 'name_format': 'ISO-15897', |
| 263 'file_format': 'chrome-json', | 262 'file_format': 'chrome-json', |
| 264 'target_platforms': {'chrome'}, | |
| 265 'default_locale': packager.defaultLocale, | 263 'default_locale': packager.defaultLocale, |
| 266 } | 264 } |
| 267 else: | 265 else: |
| 268 localeDir = os.path.join( | 266 localeDir = os.path.join( |
| 269 baseDir, *metadata.get('locales', 'base_path').split('/') | 267 baseDir, *metadata.get('locales', 'base_path').split('/') |
| 270 ) | 268 ) |
| 271 localeConfig = { | 269 localeConfig = { |
| 272 'name_format': metadata.get('locales', 'name_format'), | 270 'name_format': metadata.get('locales', 'name_format'), |
| 273 'file_format': metadata.get('locales', 'file_format'), | 271 'file_format': metadata.get('locales', 'file_format'), |
| 274 'target_platforms': set(metadata.get('locales', | |
| 275 'target_platforms').split()), | |
| 276 'default_locale': metadata.get('locales', 'default_locale') | 272 'default_locale': metadata.get('locales', 'default_locale') |
| 277 } | 273 } |
| 278 | 274 |
| 279 localeConfig['base_path'] = localeDir | 275 localeConfig['base_path'] = localeDir |
| 280 | 276 |
| 281 locales = [(locale, os.path.join(localeDir, locale)) | 277 locales = [(locale, os.path.join(localeDir, locale)) |
| 282 for locale in os.listdir(localeDir)] | 278 for locale in os.listdir(localeDir)] |
| 283 if localeConfig['name_format'] == 'ISO-15897': | 279 if localeConfig['name_format'] == 'ISO-15897': |
| 284 locales = [(locale.replace('_', '-'), localePath) | 280 locales = [(locale.replace('_', '-'), localePath) |
| 285 for locale, localePath in locales] | 281 for locale, localePath in locales] |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 if option in ('-h', '--help'): | 600 if option in ('-h', '--help'): |
| 605 usage(scriptName, type, command) | 601 usage(scriptName, type, command) |
| 606 sys.exit() | 602 sys.exit() |
| 607 commands[command](baseDir, scriptName, opts, args, type) | 603 commands[command](baseDir, scriptName, opts, args, type) |
| 608 else: | 604 else: |
| 609 print 'Command %s is not supported for this application type' % comm
and | 605 print 'Command %s is not supported for this application type' % comm
and |
| 610 usage(scriptName, type) | 606 usage(scriptName, type) |
| 611 else: | 607 else: |
| 612 print 'Command %s is unrecognized' % command | 608 print 'Command %s is unrecognized' % command |
| 613 usage(scriptName, type) | 609 usage(scriptName, type) |
| OLD | NEW |