Skip to content

Commit 8306d24

Browse files
committed
Force python2.7 on macOS
Because of this issue bazelbuild#12049 this call to python doesn't respect the PATH users invoke bazel with. Because the default shell path contains /usr/local/bin, this `python` could end up being from homebrew. Homebrew's python installations are easily borked which leads to hashlib being unusable: https://discuss.bitrise.io/t/broken-python-2-7-hashlib-in-new-xcode-10-3-x-mojave-stack/11401/7 This changes this use case to a path that always exists (at least for now) on macOS, and only falls back to the bare executable if it doesn't. Ideally this would utilize the python version from the toolchain instead.
1 parent 06f3573 commit 8306d24

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/objc/libtool.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ function hash_objfile() {
6262
echo "$SYMLINK_NAME"
6363
}
6464

65+
python_executable=/usr/bin/python2.7
66+
if [[ ! -x "$python_executable" ]]; then
67+
python_executable=python
68+
fi
69+
6570
ARGS=()
6671

6772
while [[ $# -gt 0 ]]; do
@@ -82,7 +87,7 @@ while [[ $# -gt 0 ]]; do
8287
HASHED_FILELIST="${ARG%.objlist}_hashes.objlist"
8388
rm -f "${HASHED_FILELIST}"
8489
# Use python helper script for fast md5 calculation of many strings.
85-
python "${MY_LOCATION}/make_hashed_objlist.py" \
90+
"$python_executable" "${MY_LOCATION}/make_hashed_objlist.py" \
8691
"${ARG}" "${HASHED_FILELIST}" "${TEMPDIR}"
8792
ARGS+=("${HASHED_FILELIST}")
8893
;;

0 commit comments

Comments
 (0)