Bug 1336857 - [lint] Fix 'wpt' linter on Windows, r?jgraham draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 14 Dec 2017 12:37:01 -0500
changeset 711797 8a14a22203358353b04f9a234719a8aff470266e
parent 711692 8062887ff0d9382ea84177f2c21f62dc0e613d9e
child 743877 93bd2625e6baba4429855f2e14c1fd5b985d8a9e
push id93147
push userahalberstadt@mozilla.com
push dateThu, 14 Dec 2017 17:52:35 +0000
reviewersjgraham
bugs1336857
milestone59.0a1
Bug 1336857 - [lint] Fix 'wpt' linter on Windows, r?jgraham MozReview-Commit-ID: 3yIXWkinHDD
tools/lint/wpt/wpt.py
--- 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