From a9dd9b9571c5ef88632f84d239872da9509f8aba Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 20 Dec 2021 23:14:17 +0100 Subject: [PATCH] macOS-compatible realpath --- miri | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/miri b/miri index 4be1d5bc78f..0ba7e536abe 100755 --- a/miri +++ b/miri @@ -39,12 +39,8 @@ EOF TARGET=$(rustc --version --verbose | grep "^host:" | cut -d ' ' -f 2) SYSROOT=$(rustc --print sysroot) LIBDIR=$SYSROOT/lib/rustlib/$TARGET/lib -if readlink -e . &>/dev/null; then - # This platform supports `readlink -e`. - MIRIDIR=$(dirname "$(readlink -e "$0")") -else - MIRIDIR=$(dirname "$0") -fi +# macOS does not have a useful readlink/realpath so we have to use Python instead... +MIRIDIR=$(dirname "$(python -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$0")") if ! test -d "$LIBDIR"; then echo "Something went wrong determining the library dir." echo "I got $LIBDIR but that does not exist."