build-windows.ps1 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. $ErrorActionPreference = "Stop"
  2. Set-PSDebug -trace 1
  3. # Remove virtualenv
  4. if (Test-Path venv) {
  5. Remove-Item -Recurse -Force .\venv
  6. }
  7. # Remove .pyc files
  8. Get-ChildItem -Recurse -Include *.pyc | foreach ($_) { Remove-Item $_.FullName }
  9. # Create virtualenv
  10. virtualenv .\venv
  11. # Install dependencies
  12. .\venv\Scripts\pip install pypiwin32==219
  13. .\venv\Scripts\pip install -r requirements.txt
  14. .\venv\Scripts\pip install --no-deps .
  15. # TODO: pip warns when installing from a git sha, so we need to set ErrorAction to
  16. # 'Continue'. See
  17. # https://github.com/pypa/pip/blob/fbc4b7ae5fee00f95bce9ba4b887b22681327bb1/pip/vcs/git.py#L77
  18. # This can be removed once pyinstaller 3.x is released and we upgrade
  19. $ErrorActionPreference = "Continue"
  20. .\venv\Scripts\pip install --allow-external pyinstaller -r requirements-build.txt
  21. # Build binary
  22. # pyinstaller has lots of warnings, so we need to run with ErrorAction = Continue
  23. .\venv\Scripts\pyinstaller .\docker-compose.spec
  24. $ErrorActionPreference = "Stop"
  25. Move-Item -Force .\dist\docker-compose .\dist\docker-compose-Windows-x86_64.exe
  26. .\dist\docker-compose-Windows-x86_64.exe --version