From e4db54879ea4f4d3f184f0bdda171e36a97773ed Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Wed, 4 Aug 2021 18:18:30 +0200 Subject: [PATCH] [scripts.ci] Be more verbose while running ci-check commands --- bob/devtools/scripts/ci.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bob/devtools/scripts/ci.py b/bob/devtools/scripts/ci.py index 57e45b96..92eb4e43 100644 --- a/bob/devtools/scripts/ci.py +++ b/bob/devtools/scripts/ci.py @@ -1002,7 +1002,7 @@ Example: "-d", "--dir", "root", - default=os.path.join(os.path.realpath(os.curdir)), + default=os.path.realpath(os.curdir), help="Path to the root folder of the package.", ) @verbosity_option() @@ -1012,19 +1012,23 @@ def check(root): path = os.path.join(root, "pyproject.toml") if not os.path.isfile(path): raise RuntimeError( - "pyproject.toml file not found in the root folder of the package. " + "pyproject.toml file not found at the root folder of the package. " "See https://gitlab.idiap.ch/bob/bob/-/wikis/ci-checks#pyprojecttoml" ) - # if there is a pre-commit file, run the tests + # if there is a pre-commit configuration file, run the tests path = os.path.join(root, ".pre-commit-config.yaml") if os.path.isfile(path): + from shutil import which + from ..bootstrap import run_cmdline - run_cmdline(["python", "-m", "pip", "install", "pre-commit"]) + run_cmdline([which("pip"), "install", "pre-commit"]) try: backup = os.environ.get("SKIP", "") os.environ["SKIP"] = "sphinx-build,sphinx-doctest" - run_cmdline(["python", "-m", "pre_commit", "run", "--all-files"], cwd=root) + run_cmdline([which("pre-commit"), "run", "--all-files"], cwd=root) finally: os.environ["SKIP"] = backup + else: + logger.info(f"Cannot find file {path}. Skipping pre-commit checks...") -- GitLab