aboutsummaryrefslogtreecommitdiff
path: root/build.py
diff options
context:
space:
mode:
authorEinar Egilsson <einar@einaregilsson.com>2016-02-22 10:12:54 +0000
committerEinar Egilsson <einar@einaregilsson.com>2016-02-22 10:12:54 +0000
commitd37fdb27dd3b58aa5c9534f85134efd111aafe0f (patch)
tree41fa7de09cbf1b86c567b7493d7e6379c4a9742c /build.py
parent87722144b6ac563dc1fed4f5a647e74eb121b4ae (diff)
Add options url for Firefox
Diffstat (limited to 'build.py')
-rwxr-xr-xbuild.py17
1 files changed, 16 insertions, 1 deletions
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('</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):