aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-12-10 16:34:10 -0500
committerGitHub <noreply@github.com>2019-12-10 16:34:10 -0500
commit8d4cedb9117f66691e553bdca8116f18ff1283de (patch)
tree29a34107776aafaa047c19d4f80f9effde3f7869 /python/tidy/servo_tidy
parent47716cc1aafc03abc418f1cc918d42a469535e93 (diff)
parent02c55e2ecaa110120ac228c59a8778b19ef494d5 (diff)
downloadservo-8d4cedb9117f66691e553bdca8116f18ff1283de.tar.gz
servo-8d4cedb9117f66691e553bdca8116f18ff1283de.zip
Auto merge of #24575 - marmeladema:issue-23607/compat, r=SimonSapin
Enable some mach commands to be run with python3 This change finally enable the following commands to be run with python3: * `build` * `test-unit` * `package` As previously explained, `test-tidy` will require more work in the wpt repository directly. Maybe `test-tidy --no-wpt` is achievable relatively quickly though. For possible remaining bits that might need to be worked on, see https://github.com/servo/servo/issues/23607 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'python/tidy/servo_tidy')
-rw-r--r--python/tidy/servo_tidy/tidy.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index d2840cc884c..a3c1c0a9a01 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -10,6 +10,7 @@
from __future__ import print_function
import fnmatch
+import glob
import imp
import itertools
import json
@@ -19,6 +20,7 @@ import subprocess
import sys
import colorama
+import six
import toml
import voluptuous
import yaml
@@ -116,7 +118,7 @@ def is_iter_empty(iterator):
def normilize_paths(paths):
- if isinstance(paths, basestring):
+ if isinstance(paths, six.string_types):
return os.path.join(*paths.split('/'))
else:
return [os.path.join(*path.split('/')) for path in paths]
@@ -909,7 +911,7 @@ def check_config_file(config_file, print_text=True, no_wpt=False):
exclude = config_content.get("ignore", {})
# Check for invalid listed ignored directories
- exclude_dirs = exclude.get("directories", [])
+ exclude_dirs = [d for p in exclude.get("directories", []) for d in (glob.glob(p) or [p])]
skip_dirs = ["./target", "./tests"]
invalid_dirs = [d for d in exclude_dirs if not os.path.isdir(d) and not any(s in d for s in skip_dirs)]
@@ -971,7 +973,8 @@ def check_config_file(config_file, print_text=True, no_wpt=False):
def parse_config(config_file):
exclude = config_file.get("ignore", {})
# Add list of ignored directories to config
- config["ignore"]["directories"] += normilize_paths(exclude.get("directories", []))
+ ignored_directories = [d for p in exclude.get("directories", []) for d in (glob.glob(p) or [p])]
+ config["ignore"]["directories"] += normilize_paths(ignored_directories)
# Add list of ignored files to config
config["ignore"]["files"] += normilize_paths(exclude.get("files", []))
# Add list of ignored packages to config