From d37fdb27dd3b58aa5c9534f85134efd111aafe0f Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Mon, 22 Feb 2016 10:12:54 +0000 Subject: Add options url for Firefox --- build.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'build.py') diff --git a/build.py b/build.py index 9c4f4ab..890909f 100755 --- a/build.py +++ b/build.py @@ -26,7 +26,22 @@ def create_firefox_addon(): os.system('jpm xpi') import glob, shutil name = glob.glob('*.xpi')[0] - shutil.move(name, os.path.join('build', 'redirector-firefox.xpi')) + new_name = os.path.join('build', 'redirector-firefox.xpi') + #Manually update the install.rdf to get the preferences button working... + + #jpm created the install.rdf during build, but doesn't allow adding a options url + #so we patch it here + with zipfile.ZipFile(name, 'r') as zin: + with zipfile.ZipFile(new_name, 'w') as zout: + zout.comment = zin.comment + for item in zin.infolist(): + bytes = zin.read(item.filename) + if item.filename == 'install.rdf': + bytes = bytes.replace('', '\n resource://redirector-at-einaregilsson-dot-com/redirector.html\n 2\n') + + zout.writestr(item, bytes) + + os.remove(name) def create_addon(files, browser): -- cgit v1.2.3