build-windows.ps1 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # Builds the Windows binary.
  2. #
  3. # From a fresh 64-bit Windows 10 install, prepare the system as follows:
  4. #
  5. # 1. Install Git:
  6. #
  7. # http://git-scm.com/download/win
  8. #
  9. # 2. Install Python 2.7.10:
  10. #
  11. # https://www.python.org/downloads/
  12. #
  13. # 3. Append ";C:\Python27;C:\Python27\Scripts" to the "Path" environment variable:
  14. #
  15. # https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sysdm_advancd_environmnt_addchange_variable.mspx?mfr=true
  16. #
  17. # 4. In Powershell, run the following commands:
  18. #
  19. # $ pip install virtualenv
  20. # $ Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
  21. #
  22. # 5. Clone the repository:
  23. #
  24. # $ git clone https://github.com/docker/compose.git
  25. # $ cd compose
  26. #
  27. # 6. Build the binary:
  28. #
  29. # .\script\build-windows.ps1
  30. $ErrorActionPreference = "Stop"
  31. # Remove virtualenv
  32. if (Test-Path venv) {
  33. Remove-Item -Recurse -Force .\venv
  34. }
  35. # Remove .pyc files
  36. Get-ChildItem -Recurse -Include *.pyc | foreach ($_) { Remove-Item $_.FullName }
  37. # Create virtualenv
  38. virtualenv .\venv
  39. # Install dependencies
  40. # TODO: pip warns when installing from a git sha, so we need to set ErrorAction to
  41. # 'Continue'. See
  42. # https://github.com/pypa/pip/blob/fbc4b7ae5fee00f95bce9ba4b887b22681327bb1/pip/vcs/git.py#L77
  43. # This can be removed once pyinstaller 3.x is released and we upgrade
  44. $ErrorActionPreference = "Continue"
  45. .\venv\Scripts\pip install pypiwin32==219
  46. .\venv\Scripts\pip install -r requirements.txt
  47. .\venv\Scripts\pip install --no-deps .
  48. .\venv\Scripts\pip install --allow-external pyinstaller -r requirements-build.txt
  49. # Build binary
  50. # pyinstaller has lots of warnings, so we need to run with ErrorAction = Continue
  51. .\venv\Scripts\pyinstaller .\docker-compose.spec
  52. $ErrorActionPreference = "Stop"
  53. Move-Item -Force .\dist\docker-compose .\dist\docker-compose-Windows-x86_64.exe
  54. .\dist\docker-compose-Windows-x86_64.exe --version