Bug 1336857 - [lint] Fix 'wpt' linter on Windows, r?jgraham
MozReview-Commit-ID: 3yIXWkinHDD
--- a/tools/lint/wpt/wpt.py
+++ b/tools/lint/wpt/wpt.py
@@ -1,16 +1,18 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
+import platform
+import sys
from mozprocess import ProcessHandler
from mozlint import result
results = []
@@ -21,18 +23,20 @@ def lint(files, config, **kwargs):
try:
data = json.loads(line)
except ValueError:
return
data["level"] = "error"
data["path"] = os.path.relpath(os.path.join(tests_dir, data["path"]), kwargs['root'])
results.append(result.from_config(config, **data))
- path = os.path.join(tests_dir, "wpt")
- proc = ProcessHandler([path, "lint", "--json"] + files, env=os.environ,
- processOutputLine=process_line)
+ cmd = [os.path.join(tests_dir, 'wpt'), 'lint', '--json'] + files
+ if platform.system() == 'Windows':
+ cmd.insert(0, sys.executable)
+
+ proc = ProcessHandler(cmd, env=os.environ, processOutputLine=process_line)
proc.run()
try:
proc.wait()
except KeyboardInterrupt:
proc.kill()
return results