spack style: warn if flake8-import-order is missing (#24590)

This commit is contained in:
Adam J. Stewart 2021-06-29 18:49:18 -05:00 committed by GitHub
parent 1c6504d2f5
commit a2b7f9997d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,15 +5,14 @@
from __future__ import print_function from __future__ import print_function
import re
import os
import sys
import argparse import argparse
import os
import re
import sys
from llnl.util.filesystem import working_dir
import llnl.util.tty as tty import llnl.util.tty as tty
import spack.paths import spack.paths
from llnl.util.filesystem import working_dir
from spack.util.executable import which from spack.util.executable import which
if sys.version_info < (3, 0): if sys.version_info < (3, 0):
@ -206,6 +205,10 @@ def run_flake8(file_list, args):
print_tool_header("flake8") print_tool_header("flake8")
flake8_cmd = which("flake8", required=True) flake8_cmd = which("flake8", required=True)
# Check if plugins are installed
if "import-order" not in flake8_cmd("--version", output=str, error=str):
tty.warn("style: flake8-import-order plugin is not installed, skipping")
output = "" output = ""
# run in chunks of 100 at a time to avoid line length limit # run in chunks of 100 at a time to avoid line length limit
# filename parameter in config *does not work* for this reliably # filename parameter in config *does not work* for this reliably