From 6d09c3a6978aa03298f78ade9b08e447dbef38d4 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Sat, 1 Jun 2024 00:09:17 +0200 Subject: [PATCH] Add pdftotext check to configure-test script [skip ci] --- tests/configure-test-env.ps1 | 15 ++++++++++++++- tests/configure-test-env.sh | 8 ++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/configure-test-env.ps1 b/tests/configure-test-env.ps1 index b24c1b39e9..ac019f230c 100644 --- a/tests/configure-test-env.ps1 +++ b/tests/configure-test-env.ps1 @@ -66,11 +66,24 @@ quarto install tinytex # Get npm in place Write-Host -ForegroundColor green ">>>> Configuring npm for MECA testing environment" -try {$null = gcm npm -ea stop; $npm=$true } catch { +try {$null = gcm npm -ea stop; $npm_exists=$true } catch { Write-Host -ForegroundColor red "No npm found - will skip any tests that require npm (e.g. JATS / MECA validation)" } If ($npm_exists) { # TODO: Check to do equivalent of virtualenv Write-Host "Setting up npm testing environment" npm install -g meca +} + +# Other tests dependencies +Write-Host -ForegroundColor green ">>>> Checking pdftotext from poppler" +try {$null = gcm pdftotext -ea stop; $pdftotext=$true } catch { + Write-Host -ForegroundColor red "No pdftotext found - Some tests requires `pdftotext` from poppler to be on PATH" + try {$null = gcm scoop -ea stop; $scoop=$true } catch { + Write-Host -ForegroundColor red "No scoop found - Scoop is a package manager for Windows - see https://scoop.sh/ and it can install poppler" + } + If($scoop) { + Write-Host -ForegroundColor green "Scoop is found so trying to install poppler for pdftotext" + scoop install poppler + } } \ No newline at end of file diff --git a/tests/configure-test-env.sh b/tests/configure-test-env.sh index d423d7bf8f..413e6f633e 100755 --- a/tests/configure-test-env.sh +++ b/tests/configure-test-env.sh @@ -77,4 +77,12 @@ then else echo "Setting up npm testing environment" npm install -g meca +fi + +# Get npm in place +echo ">>>> Do you have pdftotext installed (from poppler) ?" +pdftotext_exists=$(command -v pdftotext) +if [ -z $pdftotext_exists ] +then + echo "No pdftotext found - Some tests will require it, so you may want to install it." fi \ No newline at end of file