aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-10 17:26:15 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-10 17:26:15 -0800
commitf59ffc338e2c1df792709a823be1c1d2735e88bf (patch)
tree7268bc264e4364f9766f1b137882870bf7b90569 /tools/shared.py
parent0162cc4bdc1955b442bec1a185d024d3d30cec0e (diff)
parent3a35fd9389a18707abd51dc71e2096c64413d510 (diff)
Merge branch 'ta2bydefault'
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 632cf633..0aead08a 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -144,11 +144,22 @@ def read_pgo_data(filename):
'overflows_lines': overflows_lines
}
-# Settings
-
-class Dummy: pass
-
-Settings = Dummy() # A global singleton. Not pretty, but nicer than passing |, settings| everywhere
+# Settings. A global singleton. Not pretty, but nicer than passing |, settings| everywhere
+
+class Settings:
+ @classmethod
+ def reset(self):
+ global Settings
+ class Settings2:
+ reset = Settings.reset
+ load_defaults = Settings.load_defaults
+ Settings = Settings2
+
+ @classmethod
+ def load_defaults(self):
+ ''' Load the JS settings into Python '''
+ settings = open(path_from_root('src', 'settings.js')).read().replace('var ', 'Settings.').replace('//', '#')
+ exec(settings)
# Building