run-benchmarks.sh: Use python3 oneliner instead of jq

I am setting up a new computer and thus are missing a lot of tools. I
noticed we rely on `jq` being installed, which is a bit annoying when it
is not installed yet.

We can quite easily get rid of this dependecy on `jq` by using a simple
`python3` oneliner.
This commit is contained in:
Martin Nordholts 2022-02-02 21:02:31 +01:00
parent a565662cf3
commit 0fa99518ce

View file

@ -9,15 +9,15 @@ if ! command -v hyperfine > /dev/null 2>&1; then
exit 1 exit 1
fi fi
# Check that jq is installed. # Check that python3 is installed.
if ! command -v jq > /dev/null 2>&1; then if ! command -v python3 > /dev/null 2>&1; then
echo "'jq' does not seem to be installed." echo "'python3' does not seem to be installed."
echo "You can get it here: https://stedolan.github.io/jq" echo "You can get it here: https://www.python.org/downloads/"
exit 1 exit 1
fi fi
get_cargo_target_dir() { get_cargo_target_dir() {
cargo metadata --no-deps --format-version 1 | jq -r .target_directory cargo metadata --no-deps --format-version 1 | python3 -c 'import sys, json; print(json.load(sys.stdin)["target_directory"])'
} }
heading() { heading() {