buildozer - 如何为本地目录中的包而不是 zip 文件 url 编写 python-for-android 配方?
问题描述
我有
buildozer.spec
recipes/
myrecipe/
__init__.py
mypackage/
setup.py
code.py
但是当我尝试用file://
谷歌搜索这个问题时看到的 URL 编写一个食谱时,我得到一个错误Exception: Given path is neither a file nor a directory: /home/user/project/.buildozer/android/platform/build-armeabi-v7a/packages/mypackage/mypackage
(不是 mypackage 两次)。
我怎样才能做到这一点?
解决方案
有一个IncludedFilesBehaviour
mixin 就是为了这个,只需给它一个相对路径src_filename
:
from pythonforandroid.recipe import IncludedFilesBehaviour, CppCompiledComponentsPythonRecipe
import os
import sys
class MyRecipe(IncludedFilesBehaviour, CppCompiledComponentsPythonRecipe):
version = 'stable'
src_filename = "../../../phase-engine"
name = 'phase-engine'
depends = ['setuptools']
call_hostpython_via_targetpython = False
install_in_hostpython = True
def get_recipe_env(self, arch):
env = super().get_recipe_env(arch)
env['LDFLAGS'] += ' -lc++_shared'
return env
recipe = MyRecipe()
推荐阅读
- java - AEM 水疗中心导航
- python - 如何对模块外的文件使用 Sphinx 自动功能
- google-chrome - Firefox Ctrl-F 与选定的文本到主搜索栏
- javascript - 如何在使用材料 ui 表的反应中向表头列条目添加超链接?
- javascript - Express .use() 回调在使用 express.static() 时被多次调用
- mysql - 将 lstart 转换为 mysql 时间戳
- python - f-string 导致 CDSW/linux 上的换行错误
- windows - 在命令行输出中搜索关键字并显示上一行的批处理文件(x5)
- reactjs - 删除 localhost 名称以部署 Next.js 时出现问题
- shadow-dom - 有没有办法使用组合来改变带有阴影 dom 的 web 组件的 CSS?