blacklist.txt在pythonforandroid(p4a)中的用法是什么?

What is the usage of blacklist.txt in pythonforandroid (p4a)?

在 pythonforandroid 的文档中,在 https://python-for-android.readthedocs.io/en/latest/buildoptions/,有一个名为 blacklist 的构建选项。

  • --blacklist: The path to a file containing blacklisted patterns that will be excluded from the final APK. Defaults to ./blacklist.txt

但是,在任何地方都找不到关于如何使用此文件以及这些模式应该代表什么的任何文字。例如,这是否用于排除库、文件或目录?模式是否匹配文件名或内容?模式的语法或有效 blacklist.txt 文件的示例是什么?

此文件应包含一个 glob 模式列表,即由 fnmatch 实现的,每行一个。这些模式与源目录中每个文件的完整文件路径进行比较,可能使用全局文件路径但我不确定(它可能与源目录相关)。

例如,该文件可能包含以下行:

*.txt
*/test.jpg

这将阻止所有以 .txt 结尾的文件被包含在 apk 中,以及任何子文件夹中所有名为 test.jpg 的文件。

如果使用 buildozer,android.blacklist_src buildozer.spec 选项可用于指向您选择的黑名单文件。