-
Notifications
You must be signed in to change notification settings - Fork 304
Implement Support for One-liner Installs #1957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@dotnet-policy-service agree |
Testing:$url = 'https://raw.githubusercontent.com/anonhostpi/ironpython3/iex-web-support/eng/scripts/Install-IronPython.ps1'
cd (New-Item -Path "$env:TEMP\$([guid]::NewGuid())" -ItemType Directory)
iex ((New-Object System.Net.WebClient).DownloadString($url))
# Then actually testing the install:
# - Using the shims
.\Enter-IronPythonEnvironment.ps1
ipy -c "print('Hello from shimmed IronPython!')"
# - Embedding IronPython directly into PowerShell
Import-Module ".\IronPython.dll"
& {
[IronPython.Hosting.Python]::CreateEngine().
CreateScriptSourceFromString("print('Hello from embedded IronPython!')").
Execute()
} |
|
NOTE: It maybe worth stabilizing ADDITIONAL NOTE: It may also be worth implementing this kind of install script for IronRuby |
|
NOTE: If that edge-case ever occurs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks for the PR!
|
Done! Anything else? |
bumping to 3.4.2 will occur in a later commit
Also places web install into its own example block
| .EXAMPLE | ||
| PS>Invoke-WebRequest -Uri https://github.com/IronLanguages/ironpython3/releases/download/v3.4.0/IronPython.3.4.0.zip -OutFile IronPython.3.4.0.zip | ||
| PS>Expand-Archive -Path IronPython.3.4.0.zip -DestinationPath IronPython-unzipped | ||
| PS>./IronPython-unzipped/scripts/Install-IronPython -Path ~/ipyenv/v3.4.0 | ||
| With a one-liner, install latest over the web: | ||
| The official binaries are downloaded from GitHub to the current directory, unzipped, and then the installation proceeds using the script from the unzipped directory. IronPython is installed into ~/ipyenv/v3.4.0. | ||
| PS>& ([scriptblock]::Create((iwr 'https://raw.githubusercontent.com/IronLanguages/ironpython3/main/eng/scripts/Install-IronPython.ps1').Content)) -Path ~/ipyenv/v3.4.2 | ||
| The official binaries are downloaded from GitHub to the current directory, unzipped, and then the installation proceeds using the script from the unzipped directory. IronPython is installed into ~/ipyenv/v3.4.2 | ||
| .EXAMPLE | ||
| PS>Invoke-WebRequest -Uri https://github.com/IronLanguages/ironpython3/releases/download/v3.4.2/IronPython.3.4.2.zip -OutFile IronPython.3.4.2.zip | ||
| PS>Expand-Archive -Path IronPython.3.4.2.zip -DestinationPath IronPython-unzipped | ||
| PS>./IronPython-unzipped/scripts/Install-IronPython -Path ~/ipyenv/v3.4.2 | ||
| The official binaries are downloaded from GitHub to the current directory, unzipped, and then the installation proceeds using the script from the unzipped directory. IronPython is installed into ~/ipyenv/v3.4.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to draw attention to the fact that I placed the web install into its own EXAMPLE block. Diff may be hard to read:
This is the 2 new EXAMPLE blocks:
.EXAMPLE
With a one-liner, install latest over the web:
PS>& ([scriptblock]::Create((iwr 'https://raw.githubusercontent.com/IronLanguages/ironpython3/main/eng/scripts/Install-IronPython.ps1').Content)) -Path ~/ipyenv/v3.4.2
The official binaries are downloaded from GitHub to the current directory, unzipped, and then the installation proceeds using the script from the unzipped directory. IronPython is installed into ~/ipyenv/v3.4.2
.EXAMPLE
PS>Invoke-WebRequest -Uri https://github.com/IronLanguages/ironpython3/releases/download/v3.4.2/IronPython.3.4.2.zip -OutFile IronPython.3.4.2.zip
PS>Expand-Archive -Path IronPython.3.4.2.zip -DestinationPath IronPython-unzipped
PS>./IronPython-unzipped/scripts/Install-IronPython -Path ~/ipyenv/v3.4.2
The official binaries are downloaded from GitHub to the current directory, unzipped, and then the installation proceeds using the script from the unzipped directory. IronPython is installed into ~/ipyenv/v3.4.2
Done
Tested and done
Instances of '3.4.0' in
Started an issue to track it: #1959 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It all looks good to me.
|
I announced it on Reddit: https://www.reddit.com/r/PowerShell/comments/1luv01h/full_ironpython_can_now_be_installed_via_oneliner/ Hopefully, that will gain you some maintainer traction from the PowerShell community |
Purpose: Make the
.ps1Installer Easier to UseReddit Post: https://www.reddit.com/r/PowerShell/comments/1lpk3fj/python_embedding_again/
This PR attempts to make Install-IronPython.ps1 usable via one-liner
This change
iswas based on the method Chocolatey uses in its installer:It now uses
[scriptblock]::Create((iwr $url).Content)instead. NOTE: This would be blocked in Constrained Language Mode