aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-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