mirror of
https://github.com/actions/python-versions.git
synced 2025-12-14 06:26:45 +00:00
mplement script to build and prepare packages for Python
This commit is contained in:
50
helpers/nix-helpers.psm1
Normal file
50
helpers/nix-helpers.psm1
Normal file
@@ -0,0 +1,50 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Pack folder to *.zip format
|
||||
#>
|
||||
function Pack-Zip {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$PathToArchive,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$ToolZipFile
|
||||
)
|
||||
|
||||
Write-Debug "Pack $PathToArchive to $ToolZipFile"
|
||||
Push-Location -Path $PathToArchive
|
||||
zip -q -r $ToolZipFile * | Out-Null
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Unpack *.tar file
|
||||
#>
|
||||
function Extract-TarArchive {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$ArchivePath,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$OutputDirectory
|
||||
)
|
||||
|
||||
Write-Debug "tar -C $OutputDirectory -xzf $ArchivePath --strip 1"
|
||||
tar -C $OutputDirectory -xzf $ArchivePath --strip 1
|
||||
}
|
||||
|
||||
function Create-TarArchive {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$SourceFolder,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$ArchivePath,
|
||||
[string]$CompressionType = "gz"
|
||||
)
|
||||
|
||||
$CompressionTypeArgument = If ([string]::IsNullOrWhiteSpace($CompressionType)) { "" } else { "--${CompressionType}" }
|
||||
|
||||
Push-Location $SourceFolder
|
||||
Write-Debug "tar -c $CompressionTypeArgument -f $ArchivePath ."
|
||||
tar -c $CompressionTypeArgument -f $ArchivePath .
|
||||
Pop-Location
|
||||
}
|
||||
Reference in New Issue
Block a user