限制¶
非套件資料檔案¶
可以將任意資料檔案封裝到 Python wheels 中。meson-python
會將任何安裝到 Meson 的 {datadir}
位置的資料檔案加入 wheel 中,例如透過 Meson 的 install_data()
函數。然而,當安裝產生的 wheel 時,這些檔案會被解壓縮到特定平台的位址,且沒有支援的機制能在執行時可靠地找到它們。
建議將需要在執行時存取的資料檔案包含在 Python 程式碼旁邊的套件內,並使用 importlib.resources
(或是 importlib-resources 回溯移植) 來存取它們。