Last active
July 3, 2025 08:51
-
-
Save anonhostpi/f88efce91a4ddcac8bfba477de7e7c4f to your computer and use it in GitHub Desktop.
Setup Temp IronPython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
& { | |
$ironpython = 'https://raw.githubusercontent.com/anonhostpi/ironpython3/iex-web-support/eng/scripts/Install-IronPython.ps1' | |
$returns = @{ path = "$env:TEMP\$([guid]::NewGuid().ToString())" } | |
& { | |
"Installing IronPython to temp ('$($returns.path)')..." | |
& ([scriptblock]::Create((iwr $ironpython).Content)) -Path $returns.path | |
"Installing pip to temp ('$($returns.path)')..." | |
& "$($returns.path)\ipy" -m ensurepip | |
"" | |
"Loading IronPython.dll..." | |
Import-Module "$($returns.path)\IronPython.dll" | |
"Loading IronPython.SQLite.dll..." | |
Import-Module "$($returns.path)\DLLs\IronPython.SQLite.dll" | |
"Loading IronPython.WPF.dll..." | |
Import-Module "$($returns.path)\DLLs\IronPython.WPF.dll" | |
$returns.engine = [IronPython.Hosting.Python]::CreateEngine() | |
$search_paths = $returns.engine.GetSearchPaths() | |
$search_paths.AddRange(([string[]]@( | |
"$($returns.path)" | |
"$($returns.path)\lib" | |
"$($returns.path)\lib\site-packages" | |
))) | Out-Null | |
"Search path set to '$($returns.path)'" | |
$returns.engine.SetSearchPaths($search_paths) | Out-Null | |
"Finishing WPF and SQLite IronPython libraries..." | |
$returns.engine.Execute("import sqlite3, wpf") | |
"" | |
} | ForEach-Object { | |
Write-Host $_ | |
} | |
return $returns | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment