Skip to content

Commit 37acbdd

Browse files
committed
mega-melt: check proactively for working python
1 parent 96ecf71 commit 37acbdd

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/run.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ sectionEnd() {
1919
echo "Done! [$((endTime-startTime))s]"
2020
}
2121

22+
# Check prerequisites.
23+
24+
# HACK: Work around macOS Python naming inconsistency.
25+
if command -v python3 >/dev/null 2>&1; then
26+
PYTHON=python3
27+
elif command -v python >/dev/null 2>&1; then
28+
PYTHON=python
29+
else
30+
die "This script requires Python."
31+
fi
32+
2233
sectionStart 'Generating mega-melt project'
2334

2435
dir=$(cd "$(dirname "$0")" && pwd)
@@ -57,7 +68,7 @@ cp "$pom" "$pomParent" &&
5768
mvn -B -f "$pomParent" versions:set -DnewVersion=999-mega-melt > "$versionSwapLog" &&
5869
mvn -B -f "$pomParent" install:install >> "$versionSwapLog" ||
5970
die "pom-scijava version update failed:\n$(cat "$versionSwapLog")"
60-
python "$generateMegaMeltScript" "$megaMeltDir" || die 'Generation failed!'
71+
$PYTHON "$generateMegaMeltScript" "$megaMeltDir" || die 'Generation failed!'
6172
sectionEnd # Generating mega-melt project
6273

6374
# Ensure the mega-melt dependency structure validates.
@@ -68,7 +79,7 @@ sectionStart 'Validating mega-melt project'
6879
mvn -B -f "$megaMeltPOM" dependency:tree > "$dependencyTreeLog" ||
6980
die "Invalid dependency tree:\n$(cat "$dependencyTreeLog")"
7081
mvn -B -f "$megaMeltPOM" -U clean package > "$validationLog" || {
71-
python "$filterBuildLogScript" "$validationLog" > "$validationErrorsLog"
82+
$PYTHON "$filterBuildLogScript" "$validationLog" > "$validationErrorsLog"
7283
die "Validation build failed!\n\nDependency tree:\n$(cat "$dependencyTreeLog")\n\nBuild log:\n$(cat "$validationErrorsLog")"
7384
}
7485
sectionEnd # Validating mega-melt project

0 commit comments

Comments
 (0)