From 50d0235c8a9837ce2b0b5beb6717b3cbad07e42a Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 6 Mar 2024 11:17:12 +0800 Subject: [PATCH] chore: fix Python 3.8 compatibility issue --- .devcontainer/Dockerfile | 2 +- .renovaterc.json | 7 +++++++ template/.devcontainer/Dockerfile.jinja | 5 +++++ template/.renovaterc.json.jinja | 10 ++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 971d8b2a..abb642e1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -22,7 +22,7 @@ ENV PIPX_DEFAULT_PYTHON=/usr/local/bin/python RUN pipx install pdm==2.12.4 # Install pre-commit -RUN pipx install pre-commit==3.6.2 +RUN pipx install pre-commit==3.5.0 # Create a non-root user with sudo permission ARG USERNAME=ss-python diff --git a/.renovaterc.json b/.renovaterc.json index ef051cfe..dead51f9 100644 --- a/.renovaterc.json +++ b/.renovaterc.json @@ -49,6 +49,13 @@ ] }, "semanticCommitScope": "copier-template" + }, + { + "enabled": false, + "matchCurrentVersion": "==3.5.0", + "matchPackageNames": [ + "pre-commit" + ] } ] } diff --git a/template/.devcontainer/Dockerfile.jinja b/template/.devcontainer/Dockerfile.jinja index 08d4fc48..1008dab3 100644 --- a/template/.devcontainer/Dockerfile.jinja +++ b/template/.devcontainer/Dockerfile.jinja @@ -1,3 +1,4 @@ +[% from pathjoin("includes", "version_compare.jinja") import version_higher_than -%] ARG PYTHON_VERSION={{ default_py }} ######################################################################################## @@ -22,7 +23,11 @@ ENV PIPX_DEFAULT_PYTHON=/usr/local/bin/python RUN pipx install pdm==2.12.4 # Install pre-commit +[%- if not version_higher_than(min_py, "3.9") %] +RUN pipx install pre-commit==3.5.0 +[%- else %] RUN pipx install pre-commit==3.6.2 +[%- endif %] # Create a non-root user with sudo permission ARG USERNAME={{ repo_name }} diff --git a/template/.renovaterc.json.jinja b/template/.renovaterc.json.jinja index 4e099596..d983191c 100644 --- a/template/.renovaterc.json.jinja +++ b/template/.renovaterc.json.jinja @@ -1,3 +1,4 @@ +[% from pathjoin("includes", "version_compare.jinja") import version_higher_than -%] { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "customManagers": [ @@ -54,5 +55,14 @@ }, "semanticCommitScope": "copier-template" } +[%- if not version_higher_than(min_py, "3.9") %], + { + "enabled": false, + "matchCurrentVersion": "==3.5.0", + "matchPackageNames": [ + "pre-commit" + ] + } +[%- endif %] ] }