Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix Taskfile.yml for Windows #2064

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
build: fix Taskfile.yml for Windows
Fix some issues that the Taskfile had on Windows, mostly related to
shell quoting. Mainly doing this because I'm trying to fix some Windows
specific issues and tasks in the Taskfile make it easier to work on
Windows provided they work correctly.

Other changes:
- Add a separate task for creating a venv.
aucampia committed Jul 29, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit b929e118574961c66c70d05c7bb200bc290f2d8d
34 changes: 20 additions & 14 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -59,17 +59,17 @@ tasks:
install:tox:
desc: Install tox
cmds:
- '{{._PYTHON}} -m pip install tox {{if (mustFromJson .WITH_GITHUB_ACTIONS)}}tox-gh-actions{{end}}'
- '{{._PYTHON | shellQuote}} -m pip install tox {{if (mustFromJson .WITH_GITHUB_ACTIONS)}}tox-gh-actions{{end}}'

install:pip-deps:
desc: Install pip dependencies
cmds:
- '{{._PYTHON}} -m pip install --upgrade -r requirements.txt -r requirements.dev.txt -r docs/sphinx-requirements.txt {{if (mustFromJson .INSTALL_PIP_EXTRAS)}}-r requirements.dev-extras.txt{{end}}'
- '{{._PYTHON | shellQuote}} -m pip install --upgrade -r requirements.txt -r requirements.dev.txt -r docs/sphinx-requirements.txt {{if (mustFromJson .INSTALL_PIP_EXTRAS)}}-r requirements.dev-extra.txt{{end}}'

install:flake8:
desc: Install flake8 dependencies
cmds:
- "{{._PYTHON}} -m pip install --upgrade -r requirements.flake8.txt"
- "{{._PYTHON | shellQuote}} -m pip install --upgrade -r requirements.flake8.txt"

install:deps:
desc: Install all dependencies
@@ -78,10 +78,16 @@ tasks:
- task: install:tox
- task: install:pip-deps


venv:create:
desc: Create a venv to VENV_PATH(={{.VENV_PATH}})
cmds:
- "{{.PYTHON | shellQuote}} -m venv {{.VENV_PATH}}"

venv:install:
desc: Install a venv to VENV_PATH(={{.VENV_PATH}})
desc: Create and install a venv to VENV_PATH(={{.VENV_PATH}})
cmds:
- "{{.PYTHON}} -m venv {{.VENV_PATH}}"
- task: venv:create
- task: install:pip-deps
vars: { _PYTHON: "{{.VENV_PYTHON}}" }

@@ -116,33 +122,33 @@ tasks:
{{if .TOX_EXTRA_COMMAND}}TOX_EXTRA_COMMAND={{shellQuote .TOX_EXTRA_COMMAND}}{{end}} \
{{if .COVERAGE_FILE}}COVERAGE_FILE={{shellQuote .COVERAGE_FILE}}{{end}} \
{{.TEST_HARNESS}} \
{{._PYTHON}} \
{{._PYTHON | shellQuote}} \
-m tox \
{{.CLI_ARGS}}
env:
TOXENV: '{{if .TOX_PYTHON_VERSION}}py{{mustRegexReplaceAll "^([0-9]+)[.]([0-9]+).*" .TOX_PYTHON_VERSION "${1}${2}"}}{{if (mustFromJson .EXTENSIVE)}}-extensive{{end}}{{.TOXENV_SUFFIX | default ""}}{{end}}'
test:
desc: Run tests
cmds:
- '{{.TEST_HARNESS}}{{.VENV_BINPREFIX}}pytest {{if (mustFromJson .WITH_COVERAGE)}}--cov --cov-report={{end}} {{.CLI_ARGS}}'
- '{{.TEST_HARNESS}}{{print .VENV_BINPREFIX "pytest" | shellQuote}} {{if (mustFromJson .WITH_COVERAGE)}}--cov --cov-report={{end}} {{.CLI_ARGS}}'

flake8:
desc: Run flake8
cmds:
- "{{._PYTHON}} -m flakeheaven lint {{.CLI_ARGS}}"
- "{{._PYTHON | shellQuote}} -m flakeheaven lint {{.CLI_ARGS}}"

black:
desc: Run black
cmds:
- '{{._PYTHON}} -m black {{if (mustFromJson (.CHECK | default "false"))}}--check --diff {{end}}{{.CLI_ARGS | default "."}}'
- '{{._PYTHON | shellQuote}} -m black {{if (mustFromJson (.CHECK | default "false"))}}--check --diff {{end}}{{.CLI_ARGS | default "."}}'
isort:
desc: Run isort
cmds:
- '{{._PYTHON}} -m isort {{if (mustFromJson (.CHECK | default "false"))}}--check --diff {{end}}{{.CLI_ARGS | default "."}}'
- '{{._PYTHON | shellQuote}} -m isort {{if (mustFromJson (.CHECK | default "false"))}}--check --diff {{end}}{{.CLI_ARGS | default "."}}'
mypy:
desc: Run mypy
cmds:
- "{{._PYTHON}} -m mypy --show-error-context --show-error-codes"
- "{{._PYTHON | shellQuote}} -m mypy --show-error-context --show-error-codes"

lint:fix:
desc: Fix auto-fixable linting errors
@@ -186,7 +192,7 @@ tasks:
desc: Build documentation
cmds:
- echo "PYTHONPATH=${PYTHONPATH}"
- "{{._PYTHON}} -m sphinx.cmd.build -b html -d docs/_build/doctrees docs/ docs/_build/html -W {{.CLI_ARGS}}"
- "{{._PYTHON | shellQuote}} -m sphinx.cmd.build -b html -d docs/_build/doctrees docs/ docs/_build/html -W {{.CLI_ARGS}}"

docs:live-server:
desc: Run a live server on generated docs
@@ -257,7 +263,7 @@ tasks:
- task: install:tox
vars:
WITH_GITHUB_ACTIONS: true
- cmd: "{{._PYTHON}} -m pip install coveralls"
- cmd: "{{._PYTHON | shellQuote}} -m pip install coveralls"
- task: tox
vars:
COVERAGE_FILE: ".coverage"
@@ -276,7 +282,7 @@ tasks:
# a python interpreter. The name is inspired by
# <https://www.npmjs.com/package/rimraf>.
- cmd: |
{{._PYTHON}} -c '
{{._PYTHON | shellQuote}} -c '
from pathlib import Path;
import sys, shutil;
for path in sys.argv[1:]: