Skip to content

Commit e969615

Browse files
committed
Auto merge of #1947 - RalfJung:macos-is-from-the-stone-age, r=RalfJung
macOS-compatible realpath Make behavior consistent between Linux and macOS even though macOS lacks some basic shell tools
2 parents cac6759 + a9dd9b9 commit e969615

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

miri

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ EOF
3939
TARGET=$(rustc --version --verbose | grep "^host:" | cut -d ' ' -f 2)
4040
SYSROOT=$(rustc --print sysroot)
4141
LIBDIR=$SYSROOT/lib/rustlib/$TARGET/lib
42-
if readlink -e . &>/dev/null; then
43-
# This platform supports `readlink -e`.
44-
MIRIDIR=$(dirname "$(readlink -e "$0")")
45-
else
46-
MIRIDIR=$(dirname "$0")
47-
fi
42+
# macOS does not have a useful readlink/realpath so we have to use Python instead...
43+
MIRIDIR=$(dirname "$(python -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$0")")
4844
if ! test -d "$LIBDIR"; then
4945
echo "Something went wrong determining the library dir."
5046
echo "I got $LIBDIR but that does not exist."

0 commit comments

Comments
 (0)