From a6a90f6bc7badb410fe53dea4cad95a07a6d8ad0 Mon Sep 17 00:00:00 2001 From: Carmen Bianca Bakker Date: Wed, 30 Mar 2022 11:27:33 +0200 Subject: [PATCH] [FIX] Hard-specify Python versions in pre-commit for Odoo <=12 The flake8 version used by these Odoo versions does not work with more recent versions of Python. Signed-off-by: Carmen Bianca Bakker --- src/.github/workflows/pre-commit.yml.jinja | 7 +++++++ version-specific/mqt-compat/.pre-commit-config.yaml.jinja | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/.github/workflows/pre-commit.yml.jinja b/src/.github/workflows/pre-commit.yml.jinja index 4061db9a..5d04673b 100644 --- a/src/.github/workflows/pre-commit.yml.jinja +++ b/src/.github/workflows/pre-commit.yml.jinja @@ -15,6 +15,13 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 +{%- if 10 < odoo_version < 13 %} + with: + python-version: "3.6" +{%- elif odoo_version <= 10 %} + with: + python-version: "2.7" +{%- endif %} - name: Get python version run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v1 diff --git a/version-specific/mqt-compat/.pre-commit-config.yaml.jinja b/version-specific/mqt-compat/.pre-commit-config.yaml.jinja index 1f78268e..fb263ba4 100644 --- a/version-specific/mqt-compat/.pre-commit-config.yaml.jinja +++ b/version-specific/mqt-compat/.pre-commit-config.yaml.jinja @@ -40,7 +40,7 @@ repos: rev: v3.4.1 hooks: - id: flake8 - language_version: python{% if odoo_version < 11 %}2{% else %}3{% endif %} + language_version: python{% if odoo_version < 11 %}2{% else %}3.6{% endif %} name: flake8 excluding __init__.py exclude: __init__\.py - repo: https://github.com/pre-commit/mirrors-pylint