Skip to content

Commit 9989e03

Browse files
committed
handle version calculation on systems without python2
1 parent 99b55d7 commit 9989e03

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.evergreen/config.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ functions:
2323
set -o errexit
2424
if [ -n "${github_pr_number}" -o "${is_patch}" = "true" ]; then
2525
# This is a GitHub PR or patch build, probably branched from master
26-
echo $(python ./build/calc_release_version.py --next-minor) > VERSION_CURRENT
26+
if command -v python3 2>/dev/null; then
27+
# Prefer python3 if it is available
28+
echo $(python3 ./build/calc_release_version.py --next-minor) > VERSION_CURRENT
29+
else
30+
echo $(python ./build/calc_release_version.py --next-minor) > VERSION_CURRENT
31+
fi
2732
VERSION=$VERSION_CURRENT-${version_id}
2833
else
2934
VERSION=latest

build/evergreen_config_lib/functions.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@
2929
shell_mongoc(r'''
3030
if [ -n "${github_pr_number}" -o "${is_patch}" = "true" ]; then
3131
# This is a GitHub PR or patch build, probably branched from master
32-
echo $(python ./build/calc_release_version.py --next-minor) > VERSION_CURRENT
32+
if command -v python3 2>/dev/null; then
33+
# Prefer python3 if it is available
34+
echo $(python3 ./build/calc_release_version.py --next-minor) > VERSION_CURRENT
35+
else
36+
echo $(python ./build/calc_release_version.py --next-minor) > VERSION_CURRENT
37+
fi
3338
VERSION=$VERSION_CURRENT-${version_id}
3439
else
3540
VERSION=latest

0 commit comments

Comments
 (0)