mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Remove resources/prefs.json
(#34999)
This file is not used any longer. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
3225d196fa
commit
7256590599
6 changed files with 2 additions and 223 deletions
|
@ -81,27 +81,6 @@ def copy_windows_dependencies(binary_path, destination):
|
|||
shutil.copy(path.join(binary_path, f), destination)
|
||||
|
||||
|
||||
def change_prefs(resources_path, platform):
|
||||
print("Swapping prefs")
|
||||
prefs_path = path.join(resources_path, "prefs.json")
|
||||
package_prefs_path = path.join(resources_path, "package-prefs.json")
|
||||
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)
|
||||
if "all" in package_prefs:
|
||||
pref_sets += [package_prefs["all"]]
|
||||
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)
|
||||
|
||||
|
||||
def check_call_with_randomized_backoff(args: List[str], retries: int) -> int:
|
||||
"""
|
||||
Run the given command-line arguments via `subprocess.check_call()`. If the command
|
||||
|
@ -172,7 +151,6 @@ class PackageCommands(CommandBase):
|
|||
delete(dir_to_resources)
|
||||
|
||||
shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources)
|
||||
change_prefs(dir_to_resources, "android")
|
||||
|
||||
variant = ":assemble" + flavor_name + arch_string + build_type_string
|
||||
apk_task_name = ":servoapp" + variant
|
||||
|
@ -267,8 +245,6 @@ class PackageCommands(CommandBase):
|
|||
os.makedirs(lib_dir)
|
||||
shutil.copy2(binary_path, content_dir)
|
||||
|
||||
change_prefs(dir_to_resources, "macosx")
|
||||
|
||||
print("Packaging GStreamer...")
|
||||
dmg_binary = path.join(content_dir, "servo")
|
||||
servo.gstreamer.package_gstreamer_dylibs(dmg_binary, lib_dir, self.target)
|
||||
|
@ -332,8 +308,6 @@ class PackageCommands(CommandBase):
|
|||
shutil.copy(binary_path, dir_to_temp)
|
||||
copy_windows_dependencies(target_dir, dir_to_temp)
|
||||
|
||||
change_prefs(dir_to_resources, "windows")
|
||||
|
||||
# generate Servo.wxs
|
||||
import mako.template
|
||||
template_path = path.join(dir_to_root, "support", "windows", "Servo.wxs.mako")
|
||||
|
@ -401,8 +375,6 @@ class PackageCommands(CommandBase):
|
|||
shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources)
|
||||
shutil.copy(binary_path, dir_to_temp)
|
||||
|
||||
change_prefs(dir_to_resources, "linux")
|
||||
|
||||
print("Creating tarball")
|
||||
tar_path = path.join(target_dir, 'servo-tech-demo.tar.gz')
|
||||
|
||||
|
|
|
@ -186,22 +186,6 @@ class CheckTidiness(unittest.TestCase):
|
|||
self.assertEqual('emacs file variables present', next(errors)[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
def test_malformed_json(self):
|
||||
errors = tidy.collect_errors_for_files(iterFile('malformed_json.json'), [tidy.check_json], [], print_text=False)
|
||||
self.assertEqual('Invalid control character at: line 3 column 40 (char 61)', next(errors)[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
def test_json_with_duplicate_key(self):
|
||||
errors = tidy.collect_errors_for_files(iterFile('duplicate_key.json'), [tidy.check_json], [], print_text=False)
|
||||
self.assertEqual('Duplicated Key (the_duplicated_key)', next(errors)[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
def test_json_with_unordered_keys(self):
|
||||
tidy.config["check-ordered-json-keys"].append('python/tidy/tests/unordered_key.json')
|
||||
errors = tidy.collect_errors_for_files(iterFile('unordered_key.json'), [tidy.check_json], [], print_text=False)
|
||||
self.assertEqual('Unordered key (found b before a)', next(errors)[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
def test_file_list(self):
|
||||
file_path = os.path.join(BASE_PATH, 'test_ignored')
|
||||
file_list = tidy.FileList(file_path, only_changed_files=False, exclude_dirs=[], progress=False)
|
||||
|
|
|
@ -46,7 +46,6 @@ config = {
|
|||
"skip-check-length": False,
|
||||
"skip-check-licenses": False,
|
||||
"check-alphabetical-order": True,
|
||||
"check-ordered-json-keys": [],
|
||||
"lint-scripts": [],
|
||||
"blocked-packages": {},
|
||||
"ignore": {
|
||||
|
@ -709,44 +708,6 @@ def check_webidl_spec(file_name, contents):
|
|||
yield (0, "No specification link found.")
|
||||
|
||||
|
||||
def check_for_possible_duplicate_json_keys(key_value_pairs):
|
||||
keys = [x[0] for x in key_value_pairs]
|
||||
seen_keys = set()
|
||||
for key in keys:
|
||||
if key in seen_keys:
|
||||
raise KeyError("Duplicated Key (%s)" % key)
|
||||
|
||||
seen_keys.add(key)
|
||||
|
||||
|
||||
def check_for_alphabetical_sorted_json_keys(key_value_pairs):
|
||||
for a, b in zip(key_value_pairs[:-1], key_value_pairs[1:]):
|
||||
if a[0] > b[0]:
|
||||
raise KeyError("Unordered key (found %s before %s)" % (a[0], b[0]))
|
||||
|
||||
|
||||
def check_json_requirements(filename):
|
||||
def check_fn(key_value_pairs):
|
||||
check_for_possible_duplicate_json_keys(key_value_pairs)
|
||||
if filename in normilize_paths(config["check-ordered-json-keys"]):
|
||||
check_for_alphabetical_sorted_json_keys(key_value_pairs)
|
||||
return check_fn
|
||||
|
||||
|
||||
def check_json(filename, contents):
|
||||
if not filename.endswith(".json"):
|
||||
return
|
||||
|
||||
try:
|
||||
json.loads(contents, object_pairs_hook=check_json_requirements(filename))
|
||||
except ValueError as e:
|
||||
match = re.search(r"line (\d+) ", e.args[0])
|
||||
line_no = match and match.group(1)
|
||||
yield (line_no, e.args[0])
|
||||
except KeyError as e:
|
||||
yield (None, e.args[0])
|
||||
|
||||
|
||||
def check_that_manifests_exist():
|
||||
# Determine the metadata and test directories from the configuration file.
|
||||
metadata_dirs = []
|
||||
|
@ -1008,7 +969,7 @@ def scan(only_changed_files=False, progress=False):
|
|||
directory_errors = check_directory_files(config['check_ext'])
|
||||
# standard checks
|
||||
files_to_check = filter_files('.', only_changed_files, progress)
|
||||
checking_functions = (check_flake8, check_webidl_spec, check_json)
|
||||
checking_functions = (check_flake8, check_webidl_spec)
|
||||
line_checking_functions = (check_license, check_by_line, check_toml, check_shell,
|
||||
check_rust, check_spec, check_modeline)
|
||||
file_errors = collect_errors_for_files(files_to_check, checking_functions, line_checking_functions)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue