☠☠ backed out by 5a8eea8a92bb ☠ ☠ | |
author | Sylvestre Ledru <sledru@mozilla.com> |
Wed, 09 May 2018 21:56:43 +0200 | |
changeset 417809 | 3676e913dbffe199ec57ec84f97545e749291ad9 |
parent 417808 | bb12ffd4b96e318f1e492661efb9747862988c77 |
child 417810 | c2e8fbd72ca649e29403c31c8cee9e36cf83ebd6 |
push id | 33980 |
push user | ebalazs@mozilla.com |
push date | Fri, 11 May 2018 09:35:12 +0000 |
treeherder | mozilla-central@8e9a4a323f0c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ahal |
bugs | 1460402 |
milestone | 62.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
tools/lint/spell/__init__.py | file | annotate | diff | comparison | revisions | |
tools/lint/spell/codespell_requirements.txt | file | annotate | diff | comparison | revisions |
--- a/tools/lint/spell/__init__.py +++ b/tools/lint/spell/__init__.py @@ -11,32 +11,39 @@ import re # Py3/Py2 compatibility. try: from json.decoder import JSONDecodeError except ImportError: JSONDecodeError = ValueError from mozlint import result +from mozlint.util import pip from mozprocess import ProcessHandlerMixin +here = os.path.abspath(os.path.dirname(__file__)) +CODESPELL_REQUIREMENTS_PATH = os.path.join(here, 'codespell_requirements.txt') CODESPELL_NOT_FOUND = """ -Unable to locate codespell, please ensure it is installed and in -your PATH or set the CODESPELL environment variable. +Could not find codespell! Install codespell and try again. + + $ pip install -U --require-hashes -r {} +""".strip().format(CODESPELL_REQUIREMENTS_PATH) + -https://github.com/lucasdemarchi/codespell or your system's package manager. -""".strip() +CODESPELL_INSTALL_ERROR = """ +Unable to install correct version of codespell +Try to install it manually with: + $ pip install -U --require-hashes -r {} +""".strip().format(CODESPELL_REQUIREMENTS_PATH) results = [] CODESPELL_FORMAT_REGEX = re.compile(r'(.*):(.*): (.*) ==> (.*)$') -here = os.path.abspath(os.path.dirname(__file__)) - class CodespellProcess(ProcessHandlerMixin): def __init__(self, config, *args, **kwargs): self.config = config kwargs['processOutputLine'] = [self.process_line] ProcessHandlerMixin.__init__(self, *args, **kwargs) def process_line(self, line): @@ -86,16 +93,20 @@ def get_codespell_binary(): try: return which.which('codespell') except which.WhichError: return None def lint(paths, config, fix=None, **lintargs): + if not pip.reinstall_program(CODESPELL_REQUIREMENTS_PATH): + print(CODESPELL_INSTALL_ERROR) + return 1 + binary = get_codespell_binary() if not binary: print(CODESPELL_NOT_FOUND) if 'MOZ_AUTOMATION' in os.environ: return 1 return []