Skip to content

Allow tox environments to run in windows (i.e. don't rely on bash) #1123

Closed
@dhermes

Description

@dhermes

Currently we heavily rely on bash in our tox.ini:


We could do this by re-thinking those commands and just using shell-agnostic commands in tox.ini or we could get someone who knows Windows well to write a PowerShell equivalent for us.


A nice tox tricks and patterns post suggests using a foo.cmd file and then

#!/bin/bash -eE

:<<"::batch"
@echo off
powershell -ExecutionPolicy ByPass -File foo.ps1 %*
goto :end
::batch

foo.sh $*
exit $?

:<<"::done"
:end
::done

where foo.ps1 is PowerShell and foo.sh is bash.

This way the ::batch heredoc gets run on Windows and skips over the foo.sh part via goto :end, while on *nix systems the ::done heredoc is skipped due to the exit $?

UPDATE: I wasn't sure what the : did before the heredocs but I see that it acts as a way to comment them out in bash. This helps explain the Windows side of things; the lines starting with : and :: are ignored, but those with : can be jumped to while the others can't.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions