Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: packagerChrome.py

Issue 11544056: Prepared buildtools for Safari (Closed)
Patch Set: Created Sept. 20, 2013, 4:05 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: packagerChrome.py
===================================================================
--- a/packagerChrome.py
+++ b/packagerChrome.py
@@ -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):
Felix Dahlke 2013/10/15 16:24:38 As I said in the other review, I think it'd be fin
Sebastian Noack 2013/10/15 17:06:56 My intention was to don't make the change on the f
Felix Dahlke 2013/10/15 22:46:11 Fair enough, sure.
+ 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,
Felix Dahlke 2013/10/15 16:24:38 Seems like the indentation is off here.
Sebastian Noack 2013/10/15 17:06:56 True, I'll fix that.
+ lstrip_blocks=True
+ )
+
+ files['firstRun.html'] = env.from_string(files['firstRun.html']).render(type=params['type'])
+
def importGeckoLocales(params, files):
import localeTools
@@ -279,10 +296,11 @@
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)
+ files[path] = re.sub(r"\bChrome\b", params['type'].capitalize(), data)
def signBinary(zipdata, keyFile):
import M2Crypto
@@ -335,6 +353,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)

Powered by Google App Engine
This is Rietveld