kivy / kivy/python-for-android

Proposal: Remove Obsolete `biglink` and `liblink` Code Path

Đang mở
#3,193 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
recipe
Ngôn ngữ chính
Python
Star
8.9k
Fork
2k
Merge trung bình
12 giờ 20 phút
Pull request đã merge (30 ngày)
9

Mô tả

**Summary**

This issue proposes the complete removal of the `biglink` and `liblink` functionality from the python-for-android codebase. This build path appears to be a legacy mechanism that is no longer used in any standard build involving a Python recipe (e.g., `python3`), making it effectively dead code. Its removal would simplify the toolchain, reduce maintenance overhead, and improve clarity for new contributors.

**Reasoning**

The primary evidence for the obsolescence of `biglink` is in `pythonforandroid/build.py`:

```python
# 4) biglink everything
info_main('# Biglinking object files')
if not ctx.python_recipe:
biglink(ctx, arch)
else:
warning(
"Context's python recipe found, "
"skipping biglink (will this work?)"
)
```

1. **The `biglink` Path is Not Executed:** The `biglink()` function is only called if `ctx.python_recipe` is `None`. However, all modern builds are initiated with a `TargetPythonRecipe` (like `python3`), which explicitly sets `ctx.python_recipe`. Therefore, the `if` condition is effectively always false, and the `else` block containing the warning is always executed.

2. **The Modern Build Process Works Differently:** The current, functional build process does not rely on combining all compiled components into a single `libpymodules.so`. Instead, it leverages the standard Python ecosystem approach where each compiled extension (e.g., from Cython or C) is built into its own `.so` file and placed in the `site-packages` directory. The Python interpreter on Android then loads these modules using the standard import mechanism, which is more robust, modular, and aligns with how Python packages are handled on other platforms.

3. **The `(will this work?)` Comment:** The warning `"skipping biglink (will this work?)"` is a historical artifact from when the build system was transitioning to the modern approach. Years of successful builds have definitively answered this question: **Yes, it works without `biglink`.** The modern method is the de facto standard, and the comment itself, while once a valid question, is now a source of confusion.

**Benefits of Removal**

* **Code Simplification:** Removing this legacy path will eliminate a significant amount of complex and now-unnecessary code, including the `biglink()` and `copylibs_function()` in `build.py` and the liblink and biglink tools in tools/.
* **Reduced Maintenance Burden:** Eliminates the need to maintain or debug a code path that is no longer in use.
* **Improved Clarity for Contributors:** New developers will no longer be confused by this obsolete build logic or the historical warning message. This makes the build process easier to understand and contribute to.

This change would be a valuable cleanup, making the python-for-android build system leaner and more aligned with its current, functional architecture. Open to discussion on any potential edge cases where this legacy code might still be triggered, although none are apparent in the standard workflow.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu trong pythonforandroid/build.py bằng cách lần theo điều kiện ctx.python_recipe và các đường dẫn biglink và copylibs_function được tham chiếu. Sau đó kiểm tra các công cụ liblink và biglink; được coi là hoàn tất khi mã lỗi thời và cảnh báo được xóa mà không ảnh hưởng đến đường dẫn build hiện đại của TargetPythonRecipe.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
build-system, tooling
Loại issue
Tái cấu trúc
Độ 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

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.