diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2018-11-28 15:38:19 -0800 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2018-11-28 15:38:19 -0800 |
commit | 6eb396874a848fb9aff040a7c5e7df02cf55b041 (patch) | |
tree | 9ed927e6e0d88840f4509687c4d27bd6023a856b /python/servo/package_commands.py | |
parent | 2625950ac253749e866cc0623a096251f307240e (diff) | |
download | servo-6eb396874a848fb9aff040a7c5e7df02cf55b041.tar.gz servo-6eb396874a848fb9aff040a7c5e7df02cf55b041.zip |
Restructure package-specific preferences, add support for VR-only prefs
Diffstat (limited to 'python/servo/package_commands.py')
-rw-r--r-- | python/servo/package_commands.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py index aa8a80af7a2..3d6e191a731 100644 --- a/python/servo/package_commands.py +++ b/python/servo/package_commands.py @@ -169,19 +169,24 @@ def copy_windows_dependencies(binary_path, destination): shutil.copy(nspr4_path, destination) -def change_prefs(resources_path, platform): +def change_prefs(resources_path, platform, vr=False): print("Swapping prefs") prefs_path = path.join(resources_path, "prefs.json") package_prefs_path = path.join(resources_path, "package-prefs.json") - os_type = "os:{}".format(platform) with open(prefs_path) as prefs, open(package_prefs_path) as package_prefs: prefs = json.load(prefs) + pref_sets = [] package_prefs = json.load(package_prefs) - for pref in package_prefs: - if os_type in pref: - prefs[pref.split(";")[1]] = package_prefs[pref] - if pref in prefs: - prefs[pref] = package_prefs[pref] + if "all" in package_prefs: + pref_sets += [package_prefs["all"]] + if vr and "vr" in package_prefs: + pref_sets += [package_prefs["vr"]] + if platform in package_prefs: + pref_sets += [package_prefs[platform]] + for pref_set in pref_sets: + for pref in pref_set: + if pref in prefs: + prefs[pref] = pref_set[pref] with open(prefs_path, "w") as out: json.dump(prefs, out, sort_keys=True, indent=2) delete(package_prefs_path) |