mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
* Update beefman.dm * Update beefman.dm * xsaxsfvvvvvvvv * Update shaded_bloodsucker.dm * yeah that thing * FUCK you * Update hunting_contract.dm * dd * vdvdfv * Update monsterhunter_weapons.dm * Update whiterabbit.dm * onokkn * Update monsterhunter_weapons.dm * Update monsterhunter_weapons.dm * efe * Update whiterabbit.dm * yeaywa * Update red_rabbit.dmi * oihop * Update HunterContract.js * wonderland.dm * gs * dcd * Update rabbit.dmi * ass * fvd * Update paradox_rabbit.dm * f * Update tgstation.dme * Delete heartbeatmoon.dmi * shtntb * sed * sfe * Update monsterhunter_weapons.dm * cdc * Update wonderland.dm * dgrd * wef * b * pipkk * Update hunting_contract.dm * Update paradox_rabbit.dm * wr * Update worn_mask.dmi * some documenting * Update areas.dm * eg * Update white_rabbit.dm * Update HunterContract.js * s * Update weapons.dmi * Update weapons.dmi * Jack in the bomb * some signals * ui * h * y * music * Update wonderlandmusic.ogg * f * v * cleanups * g * a * t * y * g * a * o * first commit * Adding our stuff back in * k * Before procs * proc refs * carps * Fixes * shuttles * dumb dumb names * I hate windows I hate windows * I hate windows I hate windows * h * Selenestation has issues * Update monsterhunter_weapons.dm * eretics * Update weapons.dmi * Update monsterhunter_weapons.dm * g * kpop * r * m * grgr * Update simple_animal_freeze.dm * Update wonderland_apocalypse.dm * Update wonderland_apocalypse.dm * d * Update fulp_defines.dm * ff * Update wonderland.dmm * Update tgstation.dme * Update infil_objectives.dm * Update infil_objectives.dm * Update monsterhunter_weapons.dm * Update monsterhunter_event.dm * Update monsterhunter_event.dm * Update areas.dm * Update monsterhunter_event.dm * Update monsterhunter_weapons.dm * Step 0, version 2 * step 0.5 - version 2 * step 1 - version 2 * 2.5 version 2 * fix * Mapping * okay fine * more mapping * uuuuu hhhh * fixes * help me * hurry * I'm killing the mf that did access helpers on this map * Welp, we lost. * Or did we? --------- Co-authored-by: SmoSmoSmoSmok <95004236+SmoSmoSmoSmok@users.noreply.github.com> Co-authored-by: Pepsilawn <reisenrui@gmail.com> Co-authored-by: SgtHunk <68669754+SgtHunk@users.noreply.github.com>
109 lines
3.7 KiB
PowerShell
109 lines
3.7 KiB
PowerShell
# bootstrap/python_.ps1
|
|
#
|
|
# Python bootstrapping script for Windows.
|
|
#
|
|
# Automatically downloads a portable edition of a pinned Python version to
|
|
# a cache directory, installs Pip, installs `requirements.txt`, and then invokes
|
|
# Python.
|
|
#
|
|
# The underscore in the name is so that typing `bootstrap/python` into
|
|
# PowerShell finds the `.bat` file first, which ensures this script executes
|
|
# regardless of ExecutionPolicy.
|
|
$host.ui.RawUI.WindowTitle = "starting :: python $args"
|
|
$ErrorActionPreference = "Stop"
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
|
|
function ExtractVersion {
|
|
param([string] $Path, [string] $Key)
|
|
foreach ($Line in Get-Content $Path) {
|
|
if ($Line.StartsWith("export $Key=")) {
|
|
return $Line.Substring("export $Key=".Length)
|
|
}
|
|
}
|
|
throw "Couldn't find value for $Key in $Path"
|
|
}
|
|
|
|
# Convenience variables
|
|
$Bootstrap = Split-Path $script:MyInvocation.MyCommand.Path
|
|
$Tools = Split-Path $Bootstrap
|
|
$Cache = "$Bootstrap/.cache"
|
|
if ($Env:TG_BOOTSTRAP_CACHE) {
|
|
$Cache = $Env:TG_BOOTSTRAP_CACHE
|
|
}
|
|
$PythonVersion = ExtractVersion -Path "$Bootstrap/../../dependencies.sh" -Key "PYTHON_VERSION"
|
|
$PythonDir = "$Cache/python-$PythonVersion"
|
|
$PythonExe = "$PythonDir/python.exe"
|
|
$Log = "$Cache/last-command.log"
|
|
|
|
# Download and unzip a portable version of Python
|
|
if (!(Test-Path $PythonExe -PathType Leaf)) {
|
|
$host.ui.RawUI.WindowTitle = "Downloading Python $PythonVersion..."
|
|
New-Item $Cache -ItemType Directory -ErrorAction silentlyContinue | Out-Null
|
|
|
|
$Archive = "$Cache/python-$PythonVersion-embed.zip"
|
|
Invoke-WebRequest `
|
|
"https://www.python.org/ftp/python/$PythonVersion/python-$PythonVersion-embed-amd64.zip" `
|
|
-OutFile $Archive `
|
|
-ErrorAction Stop
|
|
|
|
[System.IO.Compression.ZipFile]::ExtractToDirectory($Archive, $PythonDir)
|
|
|
|
$PythonVersionArray = $PythonVersion.Split(".")
|
|
$PythonVersionString = "python$($PythonVersionArray[0])$($PythonVersionArray[1])"
|
|
Write-Output "Generating PATH descriptor."
|
|
New-Item "$Cache/$PythonVersionString._pth" | Out-Null
|
|
Set-Content "$Cache/$PythonVersionString._pth" "$PythonVersionString.zip`n.`n..\..\..`nimport site`n"
|
|
# Copy a ._pth file without "import site" commented, so pip will work
|
|
Copy-Item "$Cache/$PythonVersionString._pth" $PythonDir `
|
|
-ErrorAction Stop
|
|
|
|
Remove-Item $Archive
|
|
}
|
|
|
|
# Install pip
|
|
if (!(Test-Path "$PythonDir/Scripts/pip.exe")) {
|
|
$host.ui.RawUI.WindowTitle = "Downloading Pip..."
|
|
|
|
Invoke-WebRequest "https://bootstrap.pypa.io/get-pip.py" `
|
|
-OutFile "$Cache/get-pip.py" `
|
|
-ErrorAction Stop
|
|
|
|
& $PythonExe "$Cache/get-pip.py" --no-warn-script-location
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Remove-Item "$Cache/get-pip.py" `
|
|
-ErrorAction Stop
|
|
}
|
|
|
|
# Use pip to install our requirements
|
|
if (!(Test-Path "$PythonDir/requirements.txt") -or ((Get-FileHash "$Tools/requirements.txt").hash -ne (Get-FileHash "$PythonDir/requirements.txt").hash)) {
|
|
$host.ui.RawUI.WindowTitle = "Updating dependencies..."
|
|
|
|
& $PythonExe -m pip install -U pip -r "$Tools/requirements.txt"
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Copy-Item "$Tools/requirements.txt" "$PythonDir/requirements.txt"
|
|
Write-Output "`n---`n"
|
|
}
|
|
|
|
# Invoke python with all command-line arguments
|
|
Write-Output $PythonExe | Out-File -Encoding utf8 $Log
|
|
[System.String]::Join([System.Environment]::NewLine, $args) | Out-File -Encoding utf8 -Append $Log
|
|
Write-Output "---" | Out-File -Encoding utf8 -Append $Log
|
|
$host.ui.RawUI.WindowTitle = "python $args"
|
|
$ErrorActionPreference = "Continue"
|
|
& $PythonExe -u $args 2>&1 | ForEach-Object {
|
|
$str = "$_"
|
|
if ($_.GetType() -eq [System.Management.Automation.ErrorRecord]) {
|
|
$str = $str.TrimEnd("`r`n")
|
|
}
|
|
$str | Out-File -Encoding utf8 -Append $Log
|
|
$str | Out-Host
|
|
}
|
|
exit $LastExitCode
|