Skip to content

Commit

Permalink
Fix error handling in Install-IronPython.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
BCSharp committed Nov 21, 2023
1 parent d670a31 commit 378dc4e
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions Src/Scripts/Install-IronPython.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ if (-not $ZipFile) {
# Script run from within a checked out code base
# Locate the zip archive in the standard location of the package target
$projectRoot = $PSScriptRoot | Split-Path | Split-Path
$ZipFile = @(Resolve-Path (Join-Path $projectRoot "Package/Release/Packages/IronPython-*/IronPython.3.*.zip"))
if ($ZipFile.Count -gt 1) {
Write-Error "Ambiguous implicit project zip file: $ZipFile"
} elseif ($ZipFile.Count -lt 1) {
$zipFiles = @(Resolve-Path (Join-Path $projectRoot "Package/Release/Packages/IronPython-*/IronPython.3.*.zip"))
if ($zipFiles.Count -gt 1) {
Write-Error (@("Ambiguous implicit project zip files:") + $zipFiles -join "`n")
} elseif ($zipFiles.Count -lt 1) {
Write-Error "Missing zip file. Have you run './make package'?"
}
$ZipFile = $zipFiles
} else {
Write-Error "Cannot locate implicit zip file. Provide path to the zip file using '-ZipFile <path>'."
}
Expand Down Expand Up @@ -98,7 +99,7 @@ if (-not $unzipDir) {
}

# Copy files into place
Copy-Item -Path (Join-Path $unzipDir (Join-Path $Framework "*")) -Destination $Path -Recurse
Copy-Item -Path (Join-Path $unzipDir $Framework "*") -Destination $Path -Recurse
Copy-Item -Path (Join-Path $unzipDir "lib") -Destination $Path -Recurse

# Prepare startup scripts
Expand All @@ -108,12 +109,6 @@ if ($Framework -notlike "net4*") {
#!/usr/bin/env pwsh
dotnet (Join-Path $PSScriptRoot ipy.dll) @args
'@
if ($PSVersionTable.PSEdition -eq "Desktop" -or $IsWindows) {
$ipyPath = Join-Path $Path "ipy.bat"
Set-Content -Path $ipyPath -Value @'
@dotnet "%~dp0ipy.dll" %*
'@
}
if ($IsMacOS -or $IsLinux) {
chmod +x $ipyPath
chmod +x (Join-Path $Path "ipy.sh")
Expand Down

0 comments on commit 378dc4e

Please sign in to comment.