Skip to content

Commit 6cb256f

Browse files
committed
Make: Checking env. variables on macOS
1 parent 77870cf commit 6cb256f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Still, you need a virtual environment, and it's recommended to use `uv` to creat
100100
```sh
101101
uv venv --python 3.11 # Or your preferred Python version
102102
source .venv/bin/activate # To activate the virtual environment
103-
pip install -e . # To build locally from source
103+
uv pip install -e . # To build locally from source
104104
```
105105

106106
Testing:
@@ -110,7 +110,7 @@ pip install pytest pytest-repeat tabulate # testing dependencies
110110
pytest scripts/test.py -s -x -Wd # to run tests
111111

112112
# to check supported SIMD instructions:
113-
python -c "import simsimd; print(simsimd.get_capabilities())"
113+
python -c "import simsimd; print(simsimd.get_capabilities())"
114114
```
115115

116116
Here, `-s` will output the logs.

setup.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# -*- coding: utf-8 -*-
12
from __future__ import annotations
23

4+
import os
35
import sys
46
import platform
57
import tempfile
@@ -12,6 +14,21 @@
1214
__lib_name__ = "simsimd"
1315
__version__ = Path("VERSION").read_text().strip()
1416

17+
# --------------------------------------------------------------------------- #
18+
# macOS developer‑tools sanity check #
19+
# --------------------------------------------------------------------------- #
20+
# Users occasionally end up with DEVELOPER_DIR="public" (or another bogus
21+
# path) when installing via package managers that sandbox the tool‑chain. In
22+
# that state *every* call to `xcrun` fails before the compiler even starts.
23+
# We proactively unset that var so AppleClang falls back to xcode‑select’s
24+
# default path.
25+
# --------------------------------------------------------------------------- #
26+
if sys.platform == "darwin":
27+
_bad_dev_dir = os.environ.get("DEVELOPER_DIR")
28+
if _bad_dev_dir and (_bad_dev_dir == "public" or not Path(_bad_dev_dir).exists()):
29+
print(f"[SimSIMD] Ignoring invalid DEVELOPER_DIR={_bad_dev_dir!r}")
30+
os.environ.pop("DEVELOPER_DIR", None)
31+
1532
# --------------------------------------------------------------------------- #
1633
# Compiler and linker flags common across attempts #
1734
# --------------------------------------------------------------------------- #

0 commit comments

Comments
 (0)