From a2b7f9997d96624e85c5db285592ac0c20f6ec9e Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Tue, 29 Jun 2021 18:49:18 -0500 Subject: [PATCH] spack style: warn if flake8-import-order is missing (#24590) --- lib/spack/spack/cmd/style.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/spack/spack/cmd/style.py b/lib/spack/spack/cmd/style.py index 899ba5b6d7..43c8b52d3b 100644 --- a/lib/spack/spack/cmd/style.py +++ b/lib/spack/spack/cmd/style.py @@ -5,15 +5,14 @@ from __future__ import print_function -import re -import os -import sys import argparse +import os +import re +import sys -from llnl.util.filesystem import working_dir import llnl.util.tty as tty - import spack.paths +from llnl.util.filesystem import working_dir from spack.util.executable import which if sys.version_info < (3, 0): @@ -206,6 +205,10 @@ def run_flake8(file_list, args): print_tool_header("flake8") 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 = "" # run in chunks of 100 at a time to avoid line length limit # filename parameter in config *does not work* for this reliably