2022-04-06 03:00:10 +03:00
|
|
|
param(
|
|
|
|
[Parameter(HelpMessage="install development dependencies")]
|
2022-10-17 22:29:02 +03:00
|
|
|
[switch]$d = $False,
|
|
|
|
[Parameter()]
|
2023-07-25 04:02:00 +03:00
|
|
|
[switch]$i = $False,
|
|
|
|
[Parameter()]
|
2022-10-17 22:29:02 +03:00
|
|
|
[switch]$p = $False
|
2022-04-06 03:00:10 +03:00
|
|
|
)
|
|
|
|
|
2021-10-04 20:41:49 +03:00
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
|
2022-04-06 03:00:10 +03:00
|
|
|
$extras = @()
|
|
|
|
if ($d)
|
|
|
|
{
|
|
|
|
$extras += "dev"
|
|
|
|
}
|
|
|
|
|
2023-07-25 04:02:00 +03:00
|
|
|
$editable_cli = "--editable"
|
|
|
|
if ($i)
|
|
|
|
{
|
|
|
|
$editable_cli = ""
|
|
|
|
}
|
|
|
|
|
2021-10-04 20:41:49 +03:00
|
|
|
if ([Environment]::Is64BitOperatingSystem -eq $false)
|
|
|
|
{
|
|
|
|
Write-Output "Chia requires a 64-bit Windows installation"
|
|
|
|
Exit 1
|
|
|
|
}
|
|
|
|
|
2021-10-23 02:33:17 +03:00
|
|
|
if (-not (Get-Item -ErrorAction SilentlyContinue "$env:windir\System32\msvcp140.dll").Exists)
|
2021-10-04 20:41:49 +03:00
|
|
|
{
|
|
|
|
Write-Output "Unable to find Visual C++ Runtime DLLs"
|
|
|
|
Write-Output ""
|
|
|
|
Write-Output "Download and install the Visual C++ Redistributable for Visual Studio 2019 package from:"
|
|
|
|
Write-Output "https://visualstudio.microsoft.com/downloads/#microsoft-visual-c-redistributable-for-visual-studio-2019"
|
|
|
|
Exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($null -eq (Get-Command git -ErrorAction SilentlyContinue))
|
|
|
|
{
|
|
|
|
Write-Output "Unable to find git"
|
|
|
|
Exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
git submodule update --init mozilla-ca
|
|
|
|
|
|
|
|
if ($null -eq (Get-Command py -ErrorAction SilentlyContinue))
|
|
|
|
{
|
|
|
|
Write-Output "Unable to find py"
|
|
|
|
Write-Output "Note the check box during installation of Python to install the Python Launcher for Windows."
|
|
|
|
Write-Output ""
|
|
|
|
Write-Output "https://docs.python.org/3/using/windows.html#installation-steps"
|
|
|
|
Exit 1
|
|
|
|
}
|
|
|
|
|
2023-07-14 20:49:58 +03:00
|
|
|
$supportedPythonVersions = "3.11", "3.10", "3.9", "3.8"
|
2022-07-08 03:56:33 +03:00
|
|
|
if ("$env:INSTALL_PYTHON_VERSION" -ne "")
|
2021-10-04 20:41:49 +03:00
|
|
|
{
|
2022-04-07 19:18:54 +03:00
|
|
|
$pythonVersion = $env:INSTALL_PYTHON_VERSION
|
2021-10-04 20:41:49 +03:00
|
|
|
}
|
2022-04-07 19:18:54 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
foreach ($version in $supportedPythonVersions)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
py -$version --version 2>&1 >$null
|
|
|
|
$result = $?
|
|
|
|
}
|
|
|
|
catch
|
|
|
|
{
|
|
|
|
$result = $false
|
|
|
|
}
|
|
|
|
if ($result)
|
|
|
|
{
|
|
|
|
$pythonVersion = $version
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (-not $pythonVersion)
|
|
|
|
{
|
|
|
|
$reversedPythonVersions = $supportedPythonVersions.clone()
|
|
|
|
[array]::Reverse($reversedPythonVersions)
|
|
|
|
$reversedPythonVersions = $reversedPythonVersions -join ", "
|
|
|
|
Write-Output "No usable Python version found, supported versions are: $reversedPythonVersions"
|
|
|
|
Exit 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$fullPythonVersion = (py -$pythonVersion --version).split(" ")[1]
|
|
|
|
|
|
|
|
Write-Output "Python version is: $fullPythonVersion"
|
2021-10-04 20:41:49 +03:00
|
|
|
|
2022-04-07 19:18:54 +03:00
|
|
|
$openSSLVersionStr = (py -$pythonVersion -c 'import ssl; print(ssl.OPENSSL_VERSION)')
|
|
|
|
$openSSLVersion = (py -$pythonVersion -c 'import ssl; print(ssl.OPENSSL_VERSION_NUMBER)')
|
2022-04-01 23:20:29 +03:00
|
|
|
if ($openSSLVersion -lt 269488367)
|
|
|
|
{
|
|
|
|
Write-Output "Found Python with OpenSSL version:" $openSSLVersionStr
|
|
|
|
Write-Output "Anything before 1.1.1n is vulnerable to CVE-2022-0778."
|
|
|
|
}
|
|
|
|
|
2022-04-06 03:00:10 +03:00
|
|
|
if ($extras.length -gt 0)
|
|
|
|
{
|
|
|
|
$extras_cli = $extras -join ","
|
|
|
|
$extras_cli = "[$extras_cli]"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$extras_cli = ""
|
|
|
|
}
|
|
|
|
|
2022-04-07 19:18:54 +03:00
|
|
|
py -$pythonVersion -m venv venv
|
2021-10-04 20:41:49 +03:00
|
|
|
|
2022-02-01 21:26:08 +03:00
|
|
|
venv\scripts\python -m pip install --upgrade pip setuptools wheel
|
2021-10-29 20:44:46 +03:00
|
|
|
venv\scripts\pip install --extra-index-url https://pypi.chia.net/simple/ miniupnpc==2.2.2
|
2023-07-25 04:02:00 +03:00
|
|
|
venv\scripts\pip install $editable_cli ".$extras_cli" --extra-index-url https://pypi.chia.net/simple/
|
2021-10-04 20:41:49 +03:00
|
|
|
|
2022-10-17 22:29:02 +03:00
|
|
|
if ($p)
|
|
|
|
{
|
|
|
|
$PREV_VIRTUAL_ENV = "$env:VIRTUAL_ENV"
|
|
|
|
$env:VIRTUAL_ENV = "venv"
|
|
|
|
.\Install-plotter.ps1 bladebit
|
|
|
|
.\Install-plotter.ps1 madmax
|
|
|
|
$env:VIRTUAL_ENV = "$PREV_VIRTUAL_ENV"
|
|
|
|
}
|
|
|
|
|
2021-10-04 20:41:49 +03:00
|
|
|
Write-Output ""
|
|
|
|
Write-Output "Chia blockchain .\Install.ps1 complete."
|
2023-05-04 21:18:33 +03:00
|
|
|
Write-Output "For assistance join us on Discord in the #support chat channel:"
|
|
|
|
Write-Output "https://discord.gg/chia"
|
2021-10-04 20:41:49 +03:00
|
|
|
Write-Output ""
|
|
|
|
Write-Output "Try the Quick Start Guide to running chia-blockchain:"
|
|
|
|
Write-Output "https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide"
|
|
|
|
Write-Output ""
|
2022-12-19 19:55:07 +03:00
|
|
|
Write-Output "To install the GUI run '.\venv\scripts\Activate.ps1' then '.\Install-gui.ps1'."
|
2021-10-04 20:41:49 +03:00
|
|
|
Write-Output ""
|
|
|
|
Write-Output "Type '.\venv\Scripts\Activate.ps1' and then 'chia init' to begin."
|