From a06d363dff3b66f249ea29adf3aebbf16ac4ded6 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 5 Apr 2024 22:22:00 +0200 Subject: [PATCH] FIX: allow projects without pyproject.toml (#341) --- src/compwa_policy/check_dev_files/precommit.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compwa_policy/check_dev_files/precommit.py b/src/compwa_policy/check_dev_files/precommit.py index 39710e72..c4ca240f 100644 --- a/src/compwa_policy/check_dev_files/precommit.py +++ b/src/compwa_policy/check_dev_files/precommit.py @@ -10,6 +10,7 @@ from ruamel.yaml.scalarstring import DoubleQuotedScalarString from compwa_policy.errors import PrecommitError +from compwa_policy.utilities import CONFIG_PATH from compwa_policy.utilities.executor import Executor from compwa_policy.utilities.precommit.getters import find_repo from compwa_policy.utilities.pyproject import Pyproject, get_constraints_file @@ -84,6 +85,8 @@ def _update_precommit_ci_commit_msg(precommit: ModifiablePrecommit) -> None: def __has_constraint_files() -> bool: + if not CONFIG_PATH.pip_constraints.exists(): + return False python_versions = Pyproject.load().get_supported_python_versions() constraint_files = [get_constraints_file(v) for v in python_versions] constraint_paths = [Path(path) for path in constraint_files if path is not None]