Skip to content

Commit

Permalink
Add pdftotext check to configure-test script
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
cderv committed May 31, 2024
1 parent b4b53cf commit 6d09c3a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/configure-test-env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
8 changes: 8 additions & 0 deletions tests/configure-test-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6d09c3a

Please sign in to comment.