contrib/install-windows-dependencies.ps1
author Matt Harbison <matt_harbison@yahoo.com>
Thu, 24 Oct 2024 22:47:31 -0400
changeset 52127 fd200f5bcaea
parent 52029 921b8ad3feae
child 52268 2e26c21f77ca
permissions -rw-r--r--
wireprototypes: make `baseprotocolhandler` methods abstract The documentation says it's an abstract base class, so let's enforce it. The `typing.Protocol` class is already an ABC, but it only prevents instantiation if there are abstract attrs that are missing. For example, from `hg debugshell`: >>> from mercurial import wireprototypes >>> x = wireprototypes.baseprotocolhandler() Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: Can't instantiate abstract class baseprotocolhandler with abstract method name >>> class fake(wireprototypes.baseprotocolhandler): ... pass ... >>> x = fake() Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: Can't instantiate abstract class fake with abstract method name That's great, but it doesn't protect against calling non-abstract methods at runtime, rather it depends on the protocol type hint being added to method signatures or class attrs, and then running a type checker to notice when an instance is assigned that doesn't conform to the protocol. We don't widely use type hints yet, and do have a lot of class hierarchy in the repository area, which could lead to surprises like this: >>> class fake(wireprototypes.baseprotocolhandler): ... @property ... def name(self) -> bytes: ... return b'name' ... >>> z = fake() >>> z.client() >>> print(z.client()) None Oops. That was supposed to return `bytes`. So not only is a bad/unexpected value returned, but it's one that violates the type hints (since the base client() method will be annotated to return bytes). With this change, we get: >>> from mercurial import wireprototypes >>> class fake(wireprototypes.baseprotocolhandler): ... @property ... def name(self) -> bytes: ... return b'name' ... >>> x = fake() Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: Can't instantiate abstract class fake with abstract methods addcapabilities, checkperm, client, getargs, getpayload, getprotocaps, mayberedirectstdio So this looks like a reasonable safety harness to me, and lets us catch problems by running the standard tests while the type hints are being added, and pytype is improved. We should probably do this for all Protocol class methods that don't supply a method implementation.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
# install-dependencies.ps1 - Install Windows dependencies for building Mercurial
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
#
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
# Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com>
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
#
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
# This software may be used and distributed according to the terms of the
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
# GNU General Public License version 2 or any later version.
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
# This script can be used to bootstrap a Mercurial build environment on
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
# Windows.
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
#
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
# The script makes a lot of assumptions about how things should work.
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
# For example, the install location of Python is hardcoded to c:\hgdev\*.
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
#
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
# The script should be executed from a PowerShell with elevated privileges
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
# if you don't want to see a UAC prompt for various installers.
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
#
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
# The script is tested on Windows 10 and Windows Server 2019 (in EC2).
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
$VS_BUILD_TOOLS_URL = "https://download.visualstudio.microsoft.com/download/pr/a1603c02-8a66-4b83-b821-811e3610a7c4/aa2db8bb39e0cbd23e9940d8951e0bc3/vs_buildtools.exe"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
$VS_BUILD_TOOLS_SHA256 = "911E292B8E6E5F46CBC17003BDCD2D27A70E616E8D5E6E69D5D489A605CAA139"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
47198
e768294a7182 contrib: update Python versions in Windows automation
Gregory Szorc <gregory.szorc@gmail.com>
parents: 46353
diff changeset
    22
$PYTHON38_x86_URL = "https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe"
e768294a7182 contrib: update Python versions in Windows automation
Gregory Szorc <gregory.szorc@gmail.com>
parents: 46353
diff changeset
    23
$PYTHON38_x86_SHA256 = "ad07633a1f0cd795f3bf9da33729f662281df196b4567fa795829f3bb38a30ac"
e768294a7182 contrib: update Python versions in Windows automation
Gregory Szorc <gregory.szorc@gmail.com>
parents: 46353
diff changeset
    24
$PYTHON38_x64_URL = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe"
e768294a7182 contrib: update Python versions in Windows automation
Gregory Szorc <gregory.szorc@gmail.com>
parents: 46353
diff changeset
    25
$PYTHON38_x64_SHA256 = "7628244cb53408b50639d2c1287c659f4e29d3dfdb9084b11aed5870c0c6a48a"
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    26
52027
ded3d267f173 contrib: update to the latest py3.9 and 3.10 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52026
diff changeset
    27
$PYTHON39_x86_URL = "https://www.python.org/ftp/python/3.9.13/python-3.9.13.exe"
ded3d267f173 contrib: update to the latest py3.9 and 3.10 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52026
diff changeset
    28
$PYTHON39_x86_SHA256 = "F363935897BF32ADF6822BA15ED1BFED7AE2AE96477F0262650055B6E9637C35"
ded3d267f173 contrib: update to the latest py3.9 and 3.10 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52026
diff changeset
    29
$PYTHON39_X64_URL = "https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe"
ded3d267f173 contrib: update to the latest py3.9 and 3.10 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52026
diff changeset
    30
$PYTHON39_x64_SHA256 = "FB3D0466F3754752CA7FD839A09FFE53375FF2C981279FD4BC23A005458F7F5D"
45690
7a907388a4a5 contrib: install Python 3.9.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 45689
diff changeset
    31
52027
ded3d267f173 contrib: update to the latest py3.9 and 3.10 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52026
diff changeset
    32
$PYTHON310_x86_URL = "https://www.python.org/ftp/python/3.10.11/python-3.10.11.exe"
ded3d267f173 contrib: update to the latest py3.9 and 3.10 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52026
diff changeset
    33
$PYTHON310_x86_SHA256 = "BD115A575E86E61CEA9136C5A2C47E090BA484DC2DEE8B51A34111BB094266D5"
ded3d267f173 contrib: update to the latest py3.9 and 3.10 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52026
diff changeset
    34
$PYTHON310_X64_URL = "https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe"
ded3d267f173 contrib: update to the latest py3.9 and 3.10 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52026
diff changeset
    35
$PYTHON310_x64_SHA256 = "D8DEDE5005564B408BA50317108B765ED9C3C510342A598F9FD42681CBE0648B"
48357
fc1ba19ec4a0 automation: support Python 3.10 on Windows
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48356
diff changeset
    36
52028
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    37
# Final installer release for this version
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    38
$PYTHON311_x86_URL = "https://www.python.org/ftp/python/3.11.9/python-3.11.9.exe"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    39
$PYTHON311_x86_SHA256 = "AF19E5E2F03E715A822181F2CB7D4EFEF4EDA13FA4A2DB6DA12E998E46F5CBF9"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    40
$PYTHON311_X64_URL = "https://www.python.org/ftp/python/3.11.9/python-3.11.9-amd64.exe"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    41
$PYTHON311_x64_SHA256 = "5EE42C4EEE1E6B4464BB23722F90B45303F79442DF63083F05322F1785F5FDDE"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    42
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    43
$PYTHON312_X86_URL = "https://www.python.org/ftp/python/3.12.7/python-3.12.7.exe"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    44
$PYTHON312_x86_SHA256 = "5BF4F3F0A58E1661A26754AE2FF0C2499EFFF093F34833EE0921922887FB3851"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    45
$PYTHON312_x64_URL = "https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    46
$PYTHON312_x64_SHA256 = "1206721601A62C925D4E4A0DCFC371E88F2DDBE8C0C07962EBB2BE9B5BDE4570"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    47
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    48
$PYTHON313_x86_URL = "https://www.python.org/ftp/python/3.13.0/python-3.13.0.exe"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    49
$PYTHON313_x86_SHA256 = "A9BE7082CCD3D0B947D14A87BCEADB1A3551382A68FCB64D245A2EBCC779B272"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    50
$PYTHON313_X64_URL = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    51
$PYTHON313_x64_SHA256 = "78156AD0CF0EC4123BFB5333B40F078596EBF15F2D062A10144863680AFBDEFC"
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
    52
52029
921b8ad3feae contrib: install pip 24.2 in the Windows dependency installer script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52028
diff changeset
    53
# PIP 24.2.
921b8ad3feae contrib: install pip 24.2 in the Windows dependency installer script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52028
diff changeset
    54
$PIP_URL = "https://github.com/pypa/get-pip/raw/66d8a0f637083e2c3ddffc0cb1e65ce126afb856/public/get-pip.py"
921b8ad3feae contrib: install pip 24.2 in the Windows dependency installer script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52028
diff changeset
    55
$PIP_SHA256 = "6FB7B781206356F45AD79EFBB19322CAA6C2A5AD39092D0D44D0FEC94117E118"
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    56
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    57
$INNO_SETUP_URL = "http://files.jrsoftware.org/is/5/innosetup-5.6.1-unicode.exe"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    58
$INNO_SETUP_SHA256 = "27D49E9BC769E9D1B214C153011978DB90DC01C2ACD1DDCD9ED7B3FE3B96B538"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    59
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    60
$MINGW_BIN_URL = "https://osdn.net/frs/redir.php?m=constant&f=mingw%2F68260%2Fmingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    61
$MINGW_BIN_SHA256 = "2AB8EFD7C7D1FC8EAF8B2FA4DA4EEF8F3E47768284C021599BC7435839A046DF"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    62
49436
c809a77dfa1c contrib: update Mercurial install in bootstrap environment
Gregory Szorc <gregory.szorc@gmail.com>
parents: 49083
diff changeset
    63
$MERCURIAL_WHEEL_FILENAME = "mercurial-6.1.4-cp39-cp39-win_amd64.whl"
c809a77dfa1c contrib: update Mercurial install in bootstrap environment
Gregory Szorc <gregory.szorc@gmail.com>
parents: 49083
diff changeset
    64
$MERCURIAL_WHEEL_URL = "https://files.pythonhosted.org/packages/82/86/fbcc4b552f6c1bdfdbbc5a68b0896a55ac3c6c0e8baf51394816bdc320bd/$MERCURIAL_WHEEL_FILENAME"
c809a77dfa1c contrib: update Mercurial install in bootstrap environment
Gregory Szorc <gregory.szorc@gmail.com>
parents: 49083
diff changeset
    65
$MERCURIAL_WHEEL_SHA256 = "ab578daec7c21786c668b0da2e71282a290d18010255719f78d0e55145020d46"
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    66
44760
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
    67
$RUSTUP_INIT_URL = "https://static.rust-lang.org/rustup/archive/1.21.1/x86_64-pc-windows-gnu/rustup-init.exe"
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
    68
$RUSTUP_INIT_SHA256 = "d17df34ba974b9b19cf5c75883a95475aa22ddc364591d75d174090d55711c72"
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
    69
47883
feb1b2b8eeec contrib: install PyOxidizer 0.17.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 47814
diff changeset
    70
$PYOXIDIZER_URL = "https://github.com/indygreg/PyOxidizer/releases/download/pyoxidizer%2F0.17/PyOxidizer-0.17.0-x64.msi"
feb1b2b8eeec contrib: install PyOxidizer 0.17.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 47814
diff changeset
    71
$PYOXIDIZER_SHA256 = "85c3bc21a18eb5e2db4dad87cca29accf725c7d59dd364a853ab5099c272024b"
47202
0de5eefbe4b2 contrib: install PyOxidizer 0.16.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 47199
diff changeset
    72
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    73
# Writing progress slows down downloads substantially. So disable it.
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    74
$progressPreference = 'silentlyContinue'
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    75
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
function Secure-Download($url, $path, $sha256) {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    77
    if (Test-Path -Path $path) {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    78
        Get-FileHash -Path $path -Algorithm SHA256 -OutVariable hash
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    79
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    80
        if ($hash.Hash -eq $sha256) {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    81
            Write-Output "SHA256 of $path verified as $sha256"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    82
            return
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    83
        }
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    84
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    85
        Write-Output "hash mismatch on $path; downloading again"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    86
    }
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    87
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    88
    Write-Output "downloading $url to $path"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    89
    Invoke-WebRequest -Uri $url -OutFile $path
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    90
    Get-FileHash -Path $path -Algorithm SHA256 -OutVariable hash
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    91
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    92
    if ($hash.Hash -ne $sha256) {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    93
        Remove-Item -Path $path
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    94
        throw "hash mismatch when downloading $url; got $($hash.Hash), expected $sha256"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    95
    }
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    96
}
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    97
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    98
function Invoke-Process($path, $arguments) {
47811
fb7d17496aca contrib: log the command and args for every process installing windows deps
Matt Harbison <matt_harbison@yahoo.com>
parents: 47202
diff changeset
    99
    echo "$path $arguments"
fb7d17496aca contrib: log the command and args for every process installing windows deps
Matt Harbison <matt_harbison@yahoo.com>
parents: 47202
diff changeset
   100
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   101
    $p = Start-Process -FilePath $path -ArgumentList $arguments -Wait -PassThru -WindowStyle Hidden
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   102
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   103
    if ($p.ExitCode -ne 0) {
49082
dd381b973efc contrib: add a hint if the Windows dependency MSI is already installed
Matt Harbison <matt_harbison@yahoo.com>
parents: 48357
diff changeset
   104
        # If the MSI is already installed, ignore the error
dd381b973efc contrib: add a hint if the Windows dependency MSI is already installed
Matt Harbison <matt_harbison@yahoo.com>
parents: 48357
diff changeset
   105
        if ($p.ExitCode -eq 1638) {
dd381b973efc contrib: add a hint if the Windows dependency MSI is already installed
Matt Harbison <matt_harbison@yahoo.com>
parents: 48357
diff changeset
   106
            Write-Output "program already installed; continuing..."
dd381b973efc contrib: add a hint if the Windows dependency MSI is already installed
Matt Harbison <matt_harbison@yahoo.com>
parents: 48357
diff changeset
   107
        }
dd381b973efc contrib: add a hint if the Windows dependency MSI is already installed
Matt Harbison <matt_harbison@yahoo.com>
parents: 48357
diff changeset
   108
        else {
dd381b973efc contrib: add a hint if the Windows dependency MSI is already installed
Matt Harbison <matt_harbison@yahoo.com>
parents: 48357
diff changeset
   109
            throw "process exited non-0: $($p.ExitCode)"
dd381b973efc contrib: add a hint if the Windows dependency MSI is already installed
Matt Harbison <matt_harbison@yahoo.com>
parents: 48357
diff changeset
   110
        }
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   111
    }
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   112
}
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   113
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   114
function Install-Python3($name, $installer, $dest, $pip) {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   115
    Write-Output "installing $name"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   116
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   117
    # We hit this when running the script as part of Simple Systems Manager in
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   118
    # EC2. The Python 3 installer doesn't seem to like per-user installs
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   119
    # when running as the SYSTEM user. So enable global installs if executed in
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   120
    # this mode.
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   121
    if ($env:USERPROFILE -eq "C:\Windows\system32\config\systemprofile") {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   122
        Write-Output "running with SYSTEM account; installing for all users"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   123
        $allusers = "1"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   124
    }
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   125
    else {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   126
        $allusers = "0"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   127
    }
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   128
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   129
    Invoke-Process $installer "/quiet TargetDir=${dest} InstallAllUsers=${allusers} AssociateFiles=0 CompileAll=0 PrependPath=0 Include_doc=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_pip=0 Include_test=0"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   130
    Invoke-Process ${dest}\python.exe $pip
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   131
}
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   132
44760
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   133
function Install-Rust($prefix) {
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   134
    Write-Output "installing Rust"
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   135
    $Env:RUSTUP_HOME = "${prefix}\rustup"
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   136
    $Env:CARGO_HOME = "${prefix}\cargo"
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   137
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   138
    Invoke-Process "${prefix}\assets\rustup-init.exe" "-y --default-host x86_64-pc-windows-msvc"
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   139
    Invoke-Process "${prefix}\cargo\bin\rustup.exe" "target add i686-pc-windows-msvc"
47199
b128a3ae98ef contrib: upgrade Rust in Windows automation
Gregory Szorc <gregory.szorc@gmail.com>
parents: 47198
diff changeset
   140
    Invoke-Process "${prefix}\cargo\bin\rustup.exe" "install 1.52.0"
44760
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   141
    Invoke-Process "${prefix}\cargo\bin\rustup.exe" "component add clippy"
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   142
}
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   143
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   144
function Install-Dependencies($prefix) {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   145
    if (!(Test-Path -Path $prefix\assets)) {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   146
        New-Item -Path $prefix\assets -ItemType Directory
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   147
    }
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   148
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   149
    $pip = "${prefix}\assets\get-pip.py"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   150
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   151
    Secure-Download $PYTHON38_x86_URL ${prefix}\assets\python38-x86.exe $PYTHON38_x86_SHA256
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   152
    Secure-Download $PYTHON38_x64_URL ${prefix}\assets\python38-x64.exe $PYTHON38_x64_SHA256
45690
7a907388a4a5 contrib: install Python 3.9.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 45689
diff changeset
   153
    Secure-Download $PYTHON39_x86_URL ${prefix}\assets\python39-x86.exe $PYTHON39_x86_SHA256
7a907388a4a5 contrib: install Python 3.9.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 45689
diff changeset
   154
    Secure-Download $PYTHON39_x64_URL ${prefix}\assets\python39-x64.exe $PYTHON39_x64_SHA256
48357
fc1ba19ec4a0 automation: support Python 3.10 on Windows
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48356
diff changeset
   155
    Secure-Download $PYTHON310_x86_URL ${prefix}\assets\python310-x86.exe $PYTHON310_x86_SHA256
fc1ba19ec4a0 automation: support Python 3.10 on Windows
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48356
diff changeset
   156
    Secure-Download $PYTHON310_x64_URL ${prefix}\assets\python310-x64.exe $PYTHON310_x64_SHA256
52028
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   157
    Secure-Download $PYTHON311_x86_URL ${prefix}\assets\python311-x86.exe $PYTHON311_x86_SHA256
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   158
    Secure-Download $PYTHON311_x64_URL ${prefix}\assets\python311-x64.exe $PYTHON311_x64_SHA256
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   159
    Secure-Download $PYTHON312_x86_URL ${prefix}\assets\python312-x86.exe $PYTHON312_x86_SHA256
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   160
    Secure-Download $PYTHON312_x64_URL ${prefix}\assets\python312-x64.exe $PYTHON312_x64_SHA256
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   161
    Secure-Download $PYTHON313_x86_URL ${prefix}\assets\python313-x86.exe $PYTHON313_x86_SHA256
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   162
    Secure-Download $PYTHON313_x64_URL ${prefix}\assets\python313-x64.exe $PYTHON313_x64_SHA256
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   163
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   164
    Secure-Download $PIP_URL ${pip} $PIP_SHA256
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   165
    Secure-Download $VS_BUILD_TOOLS_URL ${prefix}\assets\vs_buildtools.exe $VS_BUILD_TOOLS_SHA256
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   166
    Secure-Download $INNO_SETUP_URL ${prefix}\assets\InnoSetup.exe $INNO_SETUP_SHA256
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   167
    Secure-Download $MINGW_BIN_URL ${prefix}\assets\mingw-get-bin.zip $MINGW_BIN_SHA256
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   168
    Secure-Download $MERCURIAL_WHEEL_URL ${prefix}\assets\${MERCURIAL_WHEEL_FILENAME} $MERCURIAL_WHEEL_SHA256
44760
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   169
    Secure-Download $RUSTUP_INIT_URL ${prefix}\assets\rustup-init.exe $RUSTUP_INIT_SHA256
47202
0de5eefbe4b2 contrib: install PyOxidizer 0.16.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 47199
diff changeset
   170
    Secure-Download $PYOXIDIZER_URL ${prefix}\assets\PyOxidizer.msi $PYOXIDIZER_SHA256
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   171
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   172
    Install-Python3 "Python 3.8 32-bit" ${prefix}\assets\python38-x86.exe ${prefix}\python38-x86 ${pip}
49082
dd381b973efc contrib: add a hint if the Windows dependency MSI is already installed
Matt Harbison <matt_harbison@yahoo.com>
parents: 48357
diff changeset
   173
    Install-Python3 "Python 3.8 64-bit" ${prefix}\assets\python38-x64.exe ${prefix}\python38-x64 ${pip}
45690
7a907388a4a5 contrib: install Python 3.9.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 45689
diff changeset
   174
    Install-Python3 "Python 3.9 32-bit" ${prefix}\assets\python39-x86.exe ${prefix}\python39-x86 ${pip}
7a907388a4a5 contrib: install Python 3.9.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 45689
diff changeset
   175
    Install-Python3 "Python 3.9 64-bit" ${prefix}\assets\python39-x64.exe ${prefix}\python39-x64 ${pip}
48357
fc1ba19ec4a0 automation: support Python 3.10 on Windows
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48356
diff changeset
   176
    Install-Python3 "Python 3.10 32-bit" ${prefix}\assets\python310-x86.exe ${prefix}\python310-x86 ${pip}
fc1ba19ec4a0 automation: support Python 3.10 on Windows
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48356
diff changeset
   177
    Install-Python3 "Python 3.10 64-bit" ${prefix}\assets\python310-x64.exe ${prefix}\python310-x64 ${pip}
52028
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   178
    Install-Python3 "Python 3.11 32-bit" ${prefix}\assets\python311-x86.exe ${prefix}\python311-x86 ${pip}
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   179
    Install-Python3 "Python 3.11 64-bit" ${prefix}\assets\python311-x64.exe ${prefix}\python311-x64 ${pip}
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   180
    Install-Python3 "Python 3.12 32-bit" ${prefix}\assets\python312-x86.exe ${prefix}\python312-x86 ${pip}
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   181
    Install-Python3 "Python 3.12 64-bit" ${prefix}\assets\python312-x64.exe ${prefix}\python312-x64 ${pip}
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   182
    Install-Python3 "Python 3.13 32-bit" ${prefix}\assets\python313-x86.exe ${prefix}\python313-x86 ${pip}
c48dc98c740c contrib: install the latest py 3.11-3.13 in the Windows dependency script
Matt Harbison <matt_harbison@yahoo.com>
parents: 52027
diff changeset
   183
    Install-Python3 "Python 3.13 64-bit" ${prefix}\assets\python313-x64.exe ${prefix}\python313-x64 ${pip}
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   184
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   185
    Write-Output "installing Visual Studio 2017 Build Tools and SDKs"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   186
    Invoke-Process ${prefix}\assets\vs_buildtools.exe "--quiet --wait --norestart --nocache --channelUri https://aka.ms/vs/15/release/channel --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Component.Windows10SDK.17763 --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.VC.140"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   187
47202
0de5eefbe4b2 contrib: install PyOxidizer 0.16.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 47199
diff changeset
   188
    Write-Output "installing PyOxidizer"
0de5eefbe4b2 contrib: install PyOxidizer 0.16.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 47199
diff changeset
   189
    Invoke-Process msiexec.exe "/i ${prefix}\assets\PyOxidizer.msi /l* ${prefix}\assets\PyOxidizer.log /quiet"
0de5eefbe4b2 contrib: install PyOxidizer 0.16.0
Gregory Szorc <gregory.szorc@gmail.com>
parents: 47199
diff changeset
   190
44760
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   191
    Install-Rust ${prefix}
6a6c15cea1fa contrib: install PyOxidizer in Linux and Windows environments
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44740
diff changeset
   192
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   193
    Write-Output "installing Inno Setup"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   194
    Invoke-Process ${prefix}\assets\InnoSetup.exe "/SP- /VERYSILENT /SUPPRESSMSGBOXES"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   195
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   196
    Write-Output "extracting MinGW base archive"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   197
    Expand-Archive -Path ${prefix}\assets\mingw-get-bin.zip -DestinationPath "${prefix}\MinGW" -Force
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   198
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   199
    Write-Output "updating MinGW package catalogs"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   200
    Invoke-Process ${prefix}\MinGW\bin\mingw-get.exe "update"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   201
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   202
    Write-Output "installing MinGW packages"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   203
    Invoke-Process ${prefix}\MinGW\bin\mingw-get.exe "install msys-base msys-coreutils msys-diffutils msys-unzip"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   204
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   205
    # Construct a virtualenv useful for bootstrapping. It conveniently contains a
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   206
    # Mercurial install.
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   207
    Write-Output "creating bootstrap virtualenv with Mercurial"
47814
3b04e4746020 contrib: switch the Windows bootstrap environment to py3.9
Matt Harbison <matt_harbison@yahoo.com>
parents: 47813
diff changeset
   208
    Invoke-Process "$prefix\python39-x64\python.exe" "-m venv ${prefix}\venv-bootstrap"
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   209
    Invoke-Process "${prefix}\venv-bootstrap\Scripts\pip.exe" "install ${prefix}\assets\${MERCURIAL_WHEEL_FILENAME}"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   210
}
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   211
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   212
function Clone-Mercurial-Repo($prefix, $repo_url, $dest) {
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   213
    Write-Output "cloning $repo_url to $dest"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   214
    # TODO Figure out why CA verification isn't working in EC2 and remove
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   215
    # --insecure.
47814
3b04e4746020 contrib: switch the Windows bootstrap environment to py3.9
Matt Harbison <matt_harbison@yahoo.com>
parents: 47813
diff changeset
   216
    Invoke-Process "${prefix}\venv-bootstrap\Scripts\python.exe" "${prefix}\venv-bootstrap\Scripts\hg clone --insecure $repo_url $dest"
42023
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   217
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   218
    # Mark repo as non-publishing by default for convenience.
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   219
    Add-Content -Path "$dest\.hg\hgrc" -Value "`n[phases]`npublish = false"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   220
}
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   221
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   222
$prefix = "c:\hgdev"
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   223
Install-Dependencies $prefix
bf87d34a675c contrib: PowerShell script to install development dependencies
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   224
Clone-Mercurial-Repo $prefix "https://www.mercurial-scm.org/repo/hg" $prefix\src