bazel-contrib / bazel-contrib/rules_python
`local_runtime_repo` writes absolute path of Xcode on macOS
- Ngôn ngữ chính
- Starlark
- Star
- 688
- Fork
- 721
- Merge trung bình
- 15 giờ 7 phút
- Pull request đã merge (30 ngày)
- 76
Mô tả
# 🐞 bug report
(Sorry for all the annoying macOS specific bugs!)
### Affected Rule
The issue is caused by the rule: `local_runtime_repo`
### Is this a regression?
Yes(?)
### Description
Starting with this change: https://github.com/bazel-contrib/rules_python/pull/2760/files#diff-33a51eb016b4b2a4b53d940f07c5388bd572ef61689051bc6f266ea7e5533c72R99
If running on macOS, `/usr/bin/python3` is a system shim that will run a Python runtime located within Xcode. The path of Xcode will then show up in `base_executable`:
```
❯ /usr/bin/python3 python/private/get_local_runtime_info.py
{"major": 3, "minor": 9, "micro": 6, "include": "/Library/Python/3.9/include", "implementation_name": "cpython", "base_executable": "/Applications/Xcode-26.0.0-Beta.app/Contents/Developer/usr/bin/python3", "LDLIBRARY": "Python3.framework/Versions/3.9/Python3", "LIBDIR": "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib", "INSTSONAME": "Python3.framework/Versions/3.9/Python3", "PY3LIBRARY": "", "SHLIB_SUFFIX": ".so"}
```
This path then ends up in the run script for i.e. `py_binary`:
```
76: PYTHON_BINARY = '/Applications/Xcode-26.0.0-Beta.app/Contents/Developer/usr/bin/python3'
```
## 🔬 Minimal Reproduction
1. macOS
2. `local_runtime_repo` setup with `interpreter_path = "/usr/bin/python3"`
3. build a `py_binary` target and observe the resulting run script
4. Change/move your Xcode version or path and rebuild. The `py_binary` path will be unchanged.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với python/private/get_local_runtime_info.py và rule local_runtime_repo, sau đó tái hiện trường hợp macOS bằng interpreter_path="/usr/bin/python3" và một target py_binary. Truy vết cách base_executable đi tới run script được tạo; hoàn tất khi việc build lại sau khi thay đổi hoặc di chuyển Xcode không còn để lại đường dẫn Xcode cũ được nhúng trong script đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- macos, python
- Lĩnh vực
- build-system, operating-systems
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100