Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta: Check for compatible Python version in WPT.sh #3106

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Meta/WPT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ if [ "$CMD" = "--help" ] || [ "$CMD" = "help" ]; then
exit 0
fi

# As of 2025-01-02 the WPT repository is not compatible with Python 3.13,
# and it looks like this is going to stay that way for a while.
# https://github.com/web-platform-tests/wpt/issues/48585
check_program_version_is_compatible Python python 3.8 3.13 || exit 1

set_logging_flags()
{
[ -n "${1}" ] || usage;
Expand Down
2 changes: 1 addition & 1 deletion Meta/ladybird.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ EOF
fi

create_build_dir() {
check_program_version_at_least CMake cmake 3.25 || exit 1
check_program_version_is_compatible CMake cmake 3.25 || exit 1
cmake --preset "$BUILD_PRESET" "${CMAKE_ARGS[@]}" -S "$LADYBIRD_SOURCE_DIR" -B "$BUILD_DIR"
}

Expand Down
17 changes: 10 additions & 7 deletions Meta/shell_include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@ exit_if_running_as_root() {
fi
}

# Usage: check_program_version_at_least <Display Name> <Program Name> <Version String>
check_program_version_at_least()
# Usage: check_program_version_is_compatible <display name> <program name> <minimum version> <optional: first version that is too high>
check_program_version_is_compatible()
{
echo -n "Checking for $1 version at least $3... "
echo -n "Checking for compatible $1 version... "
if ! command -v "$2" > /dev/null 2>&1; then
echo "ERROR: Cannot find $2 ($1)"
return 1
fi
v=$("$2" --version 2>&1 | grep -E -o '[0-9]+\.[0-9\.]+[a-z]*' | head -n1)
if printf '%s\n' "$3" "$v" | sort --version-sort --check &>/dev/null; then
if ! printf '%s\n' "$3" "$v" | sort --version-sort --check &>/dev/null; then
echo "ERROR: found version $v, which is too old! At least $3 is required."
return 1;
elif [ -n "$4" ] && printf '%s\n' "$4" "$v" | sort --version-sort --check &>/dev/null; then
echo "ERROR: found version $v, which is too new! A version below $4 is required."
return 1;
else
echo "ok, found $v"
return 0;
else
echo "ERROR: found version $v, too old!"
return 1;
fi
}

Expand Down
Loading