Skip to content

Commit

Permalink
Allow optional overrides for Python in scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Sep 8, 2024
1 parent 5255b18 commit d5e5a70
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
13 changes: 11 additions & 2 deletions scripts/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ set -eux pipefail
scripts_home="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
project_home="$(dirname "${scripts_home}")"
cd "${project_home}"
# shellcheck source=/dev/null
. "${scripts_home}/shared.sh"

isort ./*.py example/*.py example/**/*.py
black --config pyproject.toml example/ ./*.py
# unless we manually provide an override, use whatever's
# on the path by default.
if ! is-set PYTHON; then
isort ./*.py example/*.py example/**/*.py
black --config pyproject.toml example/ ./*.py
else
${PYTHON} -m isort ./*.py example/*.py example/**/*.py
${PYTHON} -m black --config pyproject.toml example/ ./*.py
fi
18 changes: 13 additions & 5 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@ set -eux pipefail
scripts_home="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
project_home="$(dirname "${scripts_home}")"
cd "${project_home}"
# shellcheck source=/dev/null
. "${scripts_home}/shared.sh"

# run our python lint checks
pylint ./*.py example/*.py example/**/*.py
pyright example/breeze_theme.py
flake8

# run our C++ lint checks
# unless we manually provide an override, use whatever's
# on the path by default.
if ! is-set PYTHON; then
pylint ./*.py example/*.py example/**/*.py
pyright example/breeze_theme.py
flake8
else
${PYTHON} -m pylint ./*.py example/*.py example/**/*.py
${PYTHON} -m pyright example/breeze_theme.py
${PYTHON} -m flake8
fi

0 comments on commit d5e5a70

Please sign in to comment.