aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Devlamynck <matthias.devlamynck@mailoo.org>2017-01-14 14:07:46 +0100
committerMatthias Devlamynck <matthias.devlamynck@mailoo.org>2017-01-14 14:07:46 +0100
commita7a2efea5ca4b364b9cab49bbf83b43d9ae0678f (patch)
treec421bc4335a25cef5d094dda6e5abab0c3d2c39c
parent655a9fd7ce27f1f985099a21d9f17209edac4ffb (diff)
downloadservo-a7a2efea5ca4b364b9cab49bbf83b43d9ae0678f.tar.gz
servo-a7a2efea5ca4b364b9cab49bbf83b43d9ae0678f.zip
Moved tidy's BLOCKED_PACKAGES to the config file
-rw-r--r--python/tidy/servo_tidy/tidy.py29
-rw-r--r--python/tidy/servo_tidy_tests/servo-tidy.toml2
-rw-r--r--servo-tidy.toml20
3 files changed, 28 insertions, 23 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index 28bf84600a3..dde357fda37 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -31,6 +31,7 @@ config = {
"skip-check-licenses": False,
"check-ordered-json-keys": [],
"lint-scripts": [],
+ "blocked-packages": {},
"ignore": {
"files": [
os.path.join(".", "."), # ignore hidden files
@@ -81,27 +82,6 @@ WEBIDL_STANDARDS = [
" accessible to\n// web pages."
]
-# Packages which we avoid using in Servo.
-# For each blocked package, we can list the exceptions,
-# which are packages allowed to use the blocked package.
-BLOCKED_PACKAGES = {
- "rand": [
- "deque",
- "gaol",
- "ipc-channel",
- "num-bigint",
- "parking_lot_core",
- "phf_generator",
- "rayon",
- "servo_rand",
- "tempdir",
- "tempfile",
- "uuid",
- "websocket",
- "ws",
- ],
-}
-
def is_iter_empty(iterator):
try:
@@ -366,7 +346,7 @@ def check_lock(file_name, contents):
for dependency in package.get("dependencies", []):
dependency = dependency.split()
dependency_name = dependency[0]
- whitelist = BLOCKED_PACKAGES.get(dependency_name)
+ whitelist = config['blocked-packages'].get(dependency_name)
if whitelist is not None:
if package_name not in whitelist:
fmt = "Package {} {} depends on blocked package {}."
@@ -856,7 +836,7 @@ def check_config_file(config_file, print_text=True):
# Check for invalid tables
if re.match("\[(.*?)\]", line.strip()):
table_name = re.findall(r"\[(.*?)\]", line)[0].strip()
- if table_name not in ("configs", "ignore", "check_ext"):
+ if table_name not in ("configs", "blocked-packages", "ignore", "check_ext"):
yield config_file, idx + 1, "invalid config table [%s]" % table_name
current_table = table_name
continue
@@ -894,6 +874,9 @@ def parse_config(content):
for path, exts in dirs_to_check.items():
config['check_ext'][normilize_paths([path])[0]] = exts
+ # Add list of blocked packages
+ config["blocked-packages"] = config_file.get("blocked-packages", {})
+
# Override default configs
user_configs = config_file.get("configs", [])
for pref in user_configs:
diff --git a/python/tidy/servo_tidy_tests/servo-tidy.toml b/python/tidy/servo_tidy_tests/servo-tidy.toml
index 0aea4527b99..855ea554c72 100644
--- a/python/tidy/servo_tidy_tests/servo-tidy.toml
+++ b/python/tidy/servo_tidy_tests/servo-tidy.toml
@@ -5,6 +5,8 @@ skip-check-length = false
skip-check-licenses = false
wrong-key = false
+[blocked-packages]
+
[wrong]
wrong-key = true
diff --git a/servo-tidy.toml b/servo-tidy.toml
index 4fb06b97d60..92ab924185f 100644
--- a/servo-tidy.toml
+++ b/servo-tidy.toml
@@ -8,6 +8,26 @@ lint-scripts = [
"./python/servo/lints/wpt_lint.py",
]
+# Packages which we avoid using in Servo.
+# For each blocked package, we can list the exceptions,
+# which are packages allowed to use the blocked package.
+[blocked-packages]
+rand = [
+ "deque",
+ "gaol",
+ "ipc-channel",
+ "num-bigint",
+ "parking_lot_core",
+ "phf_generator",
+ "rayon",
+ "servo_rand",
+ "tempdir",
+ "tempfile",
+ "uuid",
+ "websocket",
+ "ws",
+]
+
[ignore]
# Ignored packages with duplicated versions
packages = ["bitflags", "byteorder", "lazy_static", "semver", "libloading"]