 Issue 11544056:
  Prepared buildtools for Safari  (Closed)
    
  
    Issue 11544056:
  Prepared buildtools for Safari  (Closed) 
  | Index: packagerChrome.py | 
| =================================================================== | 
| --- a/packagerChrome.py | 
| +++ b/packagerChrome.py | 
| @@ -34,7 +34,7 @@ | 
| return result | 
| def getPackageFiles(params): | 
| - result = set(('_locales', 'icons', 'jquery-ui', 'lib', 'skin', 'ui',)) | 
| + result = set(('_locales', 'icons', 'jquery-ui', 'lib', 'skin', 'ui', 'ext')) | 
| if params['devenv']: | 
| result.add('qunit') | 
| @@ -160,6 +160,23 @@ | 
| sourceFiles = map(lambda f: os.path.abspath(os.path.join(baseDir, f)), sourceFiles) | 
| files[file] = doRewrite(sourceFiles, args) | 
| +def convertFirstRunPage(params, files): | 
| + import jinja2 | 
| + | 
| + env = jinja2.Environment( | 
| + block_start_string='<!-- {%', | 
| + block_end_string='%} -->', | 
| + variable_start_string='<!-- {{', | 
| + variable_end_string='}} -->', | 
| + comment_start_string='<-- {#', | 
| + comment_end_string='#} -->', | 
| + | 
| + trim_blocks=True, | 
| + lstrip_blocks=True | 
| + ) | 
| + | 
| + files['firstRun.html'] = env.from_string(files['firstRun.html']).render(type=params['type']) | 
| 
Wladimir Palant
2013/10/30 13:36:01
Hardcoding the file here that needs to be passed t
 | 
| + | 
| def importGeckoLocales(params, files): | 
| import localeTools | 
| @@ -279,10 +296,14 @@ | 
| files[operaFile] = files[chromeFile] | 
| del files[chromeFile] | 
| - # Hack: Replace "Chrome" by "Opera" in the locales | 
| + if params['type'] in ('opera', 'safari'): | 
| + # Hack: Replace "Chrome" by "Opera" or "Safari" in the locales | 
| for path, data in files.iteritems(): | 
| if path.startswith("_locales/") and path.endswith("/messages.json"): | 
| - files[path] = re.sub(r"\bChrome\b", "Opera", data) | 
| + # Hack: There is exactly one text (in the first run page) that contains | 
| + # "Google Chrome" and means Google Chrome, even though it is only shown | 
| + # on Safari. | 
| + files[path] = re.sub(r"\b(?<!Google )Chrome\b", params['type'].capitalize(), data) | 
| 
Wladimir Palant
2013/10/30 13:36:01
Ouch, we should really get rid of this hack... How
 
Sebastian Noack
2013/10/30 16:12:10
I don't like that hack too, and would like to see
 
Wladimir Palant
2013/10/30 16:21:38
Actually, given that you made the hack likely to e
 | 
| def signBinary(zipdata, keyFile): | 
| import M2Crypto | 
| @@ -335,6 +356,13 @@ | 
| if metadata.has_section('convert_js'): | 
| convertJS(params, files) | 
| + if metadata.has_section('convert_img'): | 
| + from imageConversion import convertImages | 
| + convertImages(params, files) | 
| + | 
| + if 'firstRun.html' in files: | 
| + convertFirstRunPage(params, files) | 
| + | 
| if metadata.has_section('import_locales'): | 
| importGeckoLocales(params, files) |