mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Restructure package-specific preferences, add support for VR-only prefs
This commit is contained in:
parent
2625950ac2
commit
6eb396874a
2 changed files with 22 additions and 8 deletions
|
@ -169,19 +169,24 @@ def copy_windows_dependencies(binary_path, destination):
|
||||||
shutil.copy(nspr4_path, destination)
|
shutil.copy(nspr4_path, destination)
|
||||||
|
|
||||||
|
|
||||||
def change_prefs(resources_path, platform):
|
def change_prefs(resources_path, platform, vr=False):
|
||||||
print("Swapping prefs")
|
print("Swapping prefs")
|
||||||
prefs_path = path.join(resources_path, "prefs.json")
|
prefs_path = path.join(resources_path, "prefs.json")
|
||||||
package_prefs_path = path.join(resources_path, "package-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:
|
with open(prefs_path) as prefs, open(package_prefs_path) as package_prefs:
|
||||||
prefs = json.load(prefs)
|
prefs = json.load(prefs)
|
||||||
|
pref_sets = []
|
||||||
package_prefs = json.load(package_prefs)
|
package_prefs = json.load(package_prefs)
|
||||||
for pref in package_prefs:
|
if "all" in package_prefs:
|
||||||
if os_type in pref:
|
pref_sets += [package_prefs["all"]]
|
||||||
prefs[pref.split(";")[1]] = package_prefs[pref]
|
if vr and "vr" in package_prefs:
|
||||||
if pref in prefs:
|
pref_sets += [package_prefs["vr"]]
|
||||||
prefs[pref] = package_prefs[pref]
|
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:
|
with open(prefs_path, "w") as out:
|
||||||
json.dump(prefs, out, sort_keys=True, indent=2)
|
json.dump(prefs, out, sort_keys=True, indent=2)
|
||||||
delete(package_prefs_path)
|
delete(package_prefs_path)
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
{
|
{
|
||||||
"_comment": "this file is used to add some specific preferences to the Servo package (nightly builds)"
|
"_comment": "this file is used to add some specific preferences to the Servo package (nightly builds)",
|
||||||
|
"all": {},
|
||||||
|
"macosx": {},
|
||||||
|
"linux": {},
|
||||||
|
"android": {},
|
||||||
|
"windows": {},
|
||||||
|
"vr": {
|
||||||
|
"_comment": "settings specific to VR builds",
|
||||||
|
"dom.webvr.enabled": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue