summaryrefslogtreecommitdiffstats
path: root/chrome/tools/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/tools/extensions')
-rwxr-xr-xchrome/tools/extensions/chromium_extension.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/chrome/tools/extensions/chromium_extension.py b/chrome/tools/extensions/chromium_extension.py
index 81e4662..f6ecebc4 100755
--- a/chrome/tools/extensions/chromium_extension.py
+++ b/chrome/tools/extensions/chromium_extension.py
@@ -10,6 +10,7 @@ import hashlib
import logging
import optparse
import os
+import random
import re
import shutil
import sys
@@ -53,10 +54,23 @@ class ExtensionDir:
if not self.validate():
return False
try:
- f = open(os.path.join(self._root, MANIFEST_FILENAME))
+ f = open(os.path.join(self._root, MANIFEST_FILENAME), "r")
manifest = json.load(f)
f.close()
+ # Temporary hack: If the manifest doesn't have an ID, generate a random
+ # one. This is to make it easier for people to play with the extension
+ # system while we don't have the real ID mechanism in place.
+ if not "id" in manifest:
+ random_id = ""
+ for i in range(0, 40):
+ random_id += "0123456789ABCDEF"[random.randrange(0, 15)]
+ logging.info("Generated extension ID: %s" % random_id)
+ manifest["id"] = random_id;
+ f = open(os.path.join(self._root, MANIFEST_FILENAME), "w")
+ f.write(json.dumps(manifest, sort_keys=True, indent=2));
+ f.close();
+
zip_path = path + ".zip"
if os.path.exists(zip_path):
os.remove(zip_path)