# HG changeset patch # User Edwin Gao # Date 1563551789 0 # Node ID d9bce64ad7aca304c78949c548063b70c29f323a # Parent f3ea257fdfa8ef9975e288788bf144cc1d5d87e5 Bug 1559975 - fix python2 linter errors for tools/lint r=ahal Differential Revision: https://phabricator.services.mozilla.com/D37767 diff --git a/tools/lint/cpp/mingw-capitalization.py b/tools/lint/cpp/mingw-capitalization.py --- a/tools/lint/cpp/mingw-capitalization.py +++ b/tools/lint/cpp/mingw-capitalization.py @@ -1,12 +1,14 @@ # 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/. +from __future__ import absolute_import + import os import re from mozlint.types import LineType here = os.path.abspath(os.path.dirname(__file__)) HEADERS_FILE = os.path.join(here, 'mingw-headers.txt') # generated by cd mingw-w64/mingw-w64-headers && diff --git a/tools/lint/docs/conf.py b/tools/lint/docs/conf.py --- a/tools/lint/docs/conf.py +++ b/tools/lint/docs/conf.py @@ -1,16 +1,18 @@ # -*- coding: utf-8 -*- # # mozlint documentation build configuration file, created by # sphinx-quickstart on Fri Nov 27 17:38:49 2015. # # This file is execfile()d with the current directory set to its # containing dir. +from __future__ import absolute_import + import os # -- General configuration ------------------------------------------------ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ diff --git a/tools/lint/eslint/__init__.py b/tools/lint/eslint/__init__.py --- a/tools/lint/eslint/__init__.py +++ b/tools/lint/eslint/__init__.py @@ -1,21 +1,25 @@ # -*- Mode: python; c-basic-offset: 4; 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/. +from __future__ import absolute_import, print_function + import json import os import re import signal import sys + sys.path.append(os.path.join(os.path.dirname(__file__), "eslint")) -import setup_helper +from eslint import setup_helper + from mozbuild.nodeutil import find_node_executable from mozprocess import ProcessHandler from mozlint import result ESLINT_ERROR_MESSAGE = """ An error occurred running eslint. Please check the following error messages: diff --git a/tools/lint/eslint/setup_helper.py b/tools/lint/eslint/setup_helper.py --- a/tools/lint/eslint/setup_helper.py +++ b/tools/lint/eslint/setup_helper.py @@ -1,14 +1,16 @@ # -*- Mode: python; c-basic-offset: 4; 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/. +from __future__ import absolute_import, print_function + from filecmp import dircmp import json import os import platform import re from mozfile.mozfile import remove as mozfileremove import subprocess import sys diff --git a/tools/lint/hooks.py b/tools/lint/hooks.py --- a/tools/lint/hooks.py +++ b/tools/lint/hooks.py @@ -1,13 +1,15 @@ #!/usr/bin/env 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/. +from __future__ import absolute_import, print_function + import os import signal import subprocess import sys from distutils.spawn import find_executable here = os.path.dirname(os.path.realpath(__file__)) topsrcdir = os.path.join(here, os.pardir, os.pardir) diff --git a/tools/lint/hooks_clang_format.py.1559975.later b/tools/lint/hooks_clang_format.py.1559975.later new file mode 100644 --- /dev/null +++ b/tools/lint/hooks_clang_format.py.1559975.later @@ -0,0 +1,18 @@ +--- hooks_clang_format.py ++++ hooks_clang_format.py +@@ -1,13 +1,15 @@ + #!/usr/bin/env 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/. + ++from __future__ import absolute_import, print_function ++ + import os + import subprocess + from subprocess import check_output, CalledProcessError + import sys + + here = os.path.dirname(os.path.realpath(__file__)) + topsrcdir = os.path.join(here, os.pardir, os.pardir) + diff --git a/tools/lint/hooks_js_format.py.1559975.later b/tools/lint/hooks_js_format.py.1559975.later new file mode 100644 --- /dev/null +++ b/tools/lint/hooks_js_format.py.1559975.later @@ -0,0 +1,18 @@ +--- hooks_js_format.py ++++ hooks_js_format.py +@@ -1,13 +1,15 @@ + #!/usr/bin/env 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/. + ++from __future__ import absolute_import, print_function ++ + import os + import subprocess + from subprocess import check_output, CalledProcessError + import sys + + here = os.path.dirname(os.path.realpath(__file__)) + topsrcdir = os.path.join(here, os.pardir, os.pardir) + diff --git a/tools/lint/py2.yml b/tools/lint/py2.yml --- a/tools/lint/py2.yml +++ b/tools/lint/py2.yml @@ -27,17 +27,16 @@ py2: - servo - testing/gtest - testing/mochitest - testing/mozharness - testing/tools - testing/tps - testing/web-platform - toolkit - - tools/lint - tools/power/mach_commands.py - tools/profiler - tools/rb - tools/update-packaging - xpcom extensions: ['py'] support-files: - 'tools/lint/python/*compat*' diff --git a/tools/lint/rst/__init__.py.1559975.later b/tools/lint/rst/__init__.py.1559975.later new file mode 100644 --- /dev/null +++ b/tools/lint/rst/__init__.py.1559975.later @@ -0,0 +1,17 @@ +--- __init__.py ++++ __init__.py +@@ -1,13 +1,13 @@ + # 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/. + +-from __future__ import absolute_import ++from __future__ import absolute_import, print_function + + import os + import subprocess + import json + + from mozlint import result + + # Error Levels diff --git a/tools/lint/test/conftest.py b/tools/lint/test/conftest.py --- a/tools/lint/test/conftest.py +++ b/tools/lint/test/conftest.py @@ -1,8 +1,10 @@ +from __future__ import absolute_import, print_function + import os import sys from collections import defaultdict from mozbuild.base import MozbuildObject from mozlint.pathutils import findobject from mozlint.parser import Parser diff --git a/tools/lint/test/test_eslint.py.1559975.later b/tools/lint/test/test_eslint.py.1559975.later new file mode 100644 --- /dev/null +++ b/tools/lint/test/test_eslint.py.1559975.later @@ -0,0 +1,13 @@ +--- test_eslint.py ++++ test_eslint.py +@@ -1,8 +1,10 @@ ++from __future__ import absolute_import, print_function ++ + import mozunit + + from conftest import build + + LINTER = 'eslint' + + + def test_lint_with_global_exclude(lint, config, paths): diff --git a/tools/lint/test/test_flake8.py b/tools/lint/test/test_flake8.py --- a/tools/lint/test/test_flake8.py +++ b/tools/lint/test/test_flake8.py @@ -1,8 +1,10 @@ +from __future__ import absolute_import, print_function + import os import mozunit LINTER = 'flake8' def test_lint_single_file(lint, paths): diff --git a/tools/lint/yamllint_/__init__.py b/tools/lint/yamllint_/__init__.py --- a/tools/lint/yamllint_/__init__.py +++ b/tools/lint/yamllint_/__init__.py @@ -1,12 +1,14 @@ # 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/. +from __future__ import absolute_import, print_function + import re import os import signal import subprocess from collections import defaultdict from mozfile import which from mozlint import result