diff options
author | Einar Egilsson <einar@einaregilsson.com> | 2016-02-22 10:12:54 +0000 |
---|---|---|
committer | Einar Egilsson <einar@einaregilsson.com> | 2016-02-22 10:12:54 +0000 |
commit | d37fdb27dd3b58aa5c9534f85134efd111aafe0f (patch) | |
tree | 41fa7de09cbf1b86c567b7493d7e6379c4a9742c /build.py | |
parent | 87722144b6ac563dc1fed4f5a647e74eb121b4ae (diff) |
Add options url for Firefox
Diffstat (limited to 'build.py')
-rwxr-xr-x | build.py | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -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('</em:creator>', '</em:creator>\n <em:optionsURL>resource://redirector-at-einaregilsson-dot-com/redirector.html</em:optionsURL>\n <em:optionsType>2</em:optionsType>\n') + + zout.writestr(item, bytes) + + os.remove(name) def create_addon(files, browser): |