CI: Install gettext for Windows

Before that the gettext command shipping with git for Windows were used.
Since git 2.44.0 these are no longer bundled.

# Conflicts:
#	.github/workflows/package-pypi.yml
#	.github/workflows/package-windows.yml
This commit is contained in:
Philipp Wolfer
2024-02-29 21:53:53 +01:00
parent 27d665e1ee
commit 0c0583f8e7
6 changed files with 76 additions and 26 deletions

View File

@@ -85,6 +85,16 @@ jobs:
brew install gettext
brew link gettext --force
echo "/usr/local/opt/gettext/bin" >> $GITHUB_PATH
- name: Install gettext (Windows)
if: runner.os == 'Windows'
run: |
& .\scripts\package\win-setup-gettext.ps1 `
-GettextVersion $Env:GETTEXT_VERSION -GettextSha256Sum $Env:GETTEXT_SHA256SUM
Add-Content $env:GITHUB_PATH (Join-Path -Path (Resolve-Path .) -ChildPath gettext\bin)
shell: pwsh
env:
GETTEXT_VERSION: 0.22.4
GETTEXT_SHA256SUM: 220068ac0b9e7aedda03534a3088e584640ac1e639800b3a0baa9410aa6d012a
- name: Install dependencies
run: |
python -m pip install --upgrade pip

View File

@@ -154,6 +154,14 @@ jobs:
DISCID_SHA256SUM: 330199495d71f71251e91eb0b4e3103b6c663fea09ffc9fd3e5108d48e0452c8
FPCALC_VERSION: 1.5.1
FPCALC_SHA256SUM: 36b478e16aa69f757f376645db0d436073a42c0097b6bb2677109e7835b59bbc
- name: Install gettext
run: |
& .\scripts\package\win-setup-gettext.ps1 `
-GettextVersion $Env:GETTEXT_VERSION -GettextSha256Sum $Env:GETTEXT_SHA256SUM
Add-Content $env:GITHUB_PATH (Join-Path -Path (Resolve-Path .) -ChildPath gettext\bin)
env:
GETTEXT_VERSION: 0.22.4
GETTEXT_SHA256SUM: 220068ac0b9e7aedda03534a3088e584640ac1e639800b3a0baa9410aa6d012a
- name: Install dependencies
run: |
python -m pip install --upgrade pip

View File

@@ -122,6 +122,15 @@ jobs:
brew install gettext
brew link gettext --force
echo "/usr/local/opt/gettext/bin" >> $GITHUB_PATH
- name: Install gettext (Windows)
if: runner.os == 'Windows'
run: |
& .\scripts\package\win-setup-gettext.ps1 `
-GettextVersion $Env:GETTEXT_VERSION -GettextSha256Sum $Env:GETTEXT_SHA256SUM
Add-Content $env:GITHUB_PATH (Join-Path -Path (Resolve-Path .) -ChildPath gettext\bin)
env:
GETTEXT_VERSION: 0.22.4
GETTEXT_SHA256SUM: 220068ac0b9e7aedda03534a3088e584640ac1e639800b3a0baa9410aa6d012a
- name: Run pip install .
run: |
python -m pip install --upgrade pip

View File

@@ -54,3 +54,30 @@ Function FinalizePackage {
Move-Item -Path (Join-Path -Path $Qt5BinDir -ChildPath *.dll) -Destination $Path -Force
Remove-Item -Path $Qt5BinDir
}
Function DownloadFile {
Param(
[Parameter(Mandatory = $true)]
[String]
$FileName,
[Parameter(Mandatory = $true)]
[String]
$Url
)
$OutputPath = (Join-Path (Resolve-Path .) $FileName)
(New-Object System.Net.WebClient).DownloadFile($Url, "$OutputPath")
}
Function VerifyHash {
Param(
[Parameter(Mandatory = $true)]
[String]
$FileName,
[Parameter(Mandatory = $true)]
[String]
$Sha256Sum
)
If ((Get-FileHash "$FileName").hash -ne "$Sha256Sum") {
Throw "Invalid SHA256 hash for $FileName"
}
}

View File

@@ -0,0 +1,20 @@
Param(
[Parameter(Mandatory = $true)]
[String]
$GettextVersion,
[Parameter(Mandatory = $true)]
[String]
$GettextSha256Sum
)
$ErrorActionPreference = "Stop"
$ScriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
. $ScriptDirectory\win-common.ps1
$ArchiveFile = ".\gettext-tools-windows.zip"
Write-Output "Downloading gettext-tools-windows $GettextVersion to $ArchiveFile..."
DownloadFile -Url "https://github.com/vslavik/gettext-tools-windows/releases/download/v$GettextVersion/gettext-tools-windows-$GettextVersion.zip" `
-FileName $ArchiveFile
VerifyHash -FileName $ArchiveFile -Sha256Sum $GettextSha256Sum
Expand-Archive -Path $ArchiveFile -DestinationPath .\gettext -Force

View File

@@ -15,32 +15,8 @@ Param(
$ErrorActionPreference = "Stop"
Function DownloadFile {
Param(
[Parameter(Mandatory=$true)]
[String]
$FileName,
[Parameter(Mandatory=$true)]
[String]
$Url
)
$OutputPath = (Join-Path (Resolve-Path .) $FileName)
(New-Object System.Net.WebClient).DownloadFile($Url, "$OutputPath")
}
Function VerifyHash {
Param(
[Parameter(Mandatory = $true)]
[String]
$FileName,
[Parameter(Mandatory = $true)]
[String]
$Sha256Sum
)
If ((Get-FileHash "$FileName").hash -ne "$Sha256Sum") {
Throw "Invalid SHA256 hash for $FileName"
}
}
$ScriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
. $ScriptDirectory\win-common.ps1
New-Item -Name .\build -ItemType Directory -ErrorAction Ignore