Yocto ';没有名为setuptools'的模块;但它包含在DEPENDS变量中

Yocto ';没有名为setuptools'的模块;但它包含在DEPENDS变量中,yocto,openembedded,Yocto,Openembedded,这个问题与Openembedded/Yocto有关 我有一些源代码需要用自定义的python3脚本编译。 这意味着,一些python3脚本应该在do\u compile()过程中运行。 脚本导入setuptools,因此,我在配方中添加了dependens+=“python3 setuptools native”。就我对文档的理解而言,这应该使setuptools模块可用于构建过程(本机)。 但是当bitbake执行do\u compile()过程时,我得到了这个错误:没有名为“setuptoo

这个问题与Openembedded/Yocto有关

我有一些源代码需要用自定义的python3脚本编译。 这意味着,一些python3脚本应该在
do\u compile()
过程中运行。 脚本导入setuptools,因此,我在配方中添加了
dependens+=“python3 setuptools native”
。就我对文档的理解而言,这应该使setuptools模块可用于构建过程(本机)。 但是当bitbake执行
do\u compile()
过程时,我得到了这个错误:
没有名为“setuptools”的模块

让我将其分解为一个最小的(非)工作示例:

文件:test.bb

LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://test/LICENSE;md5=d41d8cd98f00b204e9800998ecf8427e"

DEPENDS += "python3-setuptools-native"

SRC_URI = "file://test.py \
           file://LICENSE"

do_compile() {
    python3 ${S}/../test.py
}
文件:test.py

import setuptools

print("HELLO")
比特烘焙:

$ bitbake test
ERROR: test-1.0-r0 do_compile: Function failed: do_compile (log file is located at /path/to/test/1.0-r0/temp/log.do_compile.8532)
ERROR: Logfile of failure stored in: /path/to/test/1.0-r0/temp/log.do_compile.8532
Log data follows:
| DEBUG: Executing shell function do_compile
| Traceback (most recent call last):
|   File "/path/to/test-1.0/../test.py", line 1, in <module>
|     import setuptools
| ImportError: No module named 'setuptools'
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /path/to/test/1.0-r0/temp/log.do_compile.8532)
ERROR: Task (/path/to/test.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 400 tasks of which 398 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory

Summary: 1 task failed:
  /path/to/test.bb:do_compile
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
$bitbake测试
错误:test-1.0-r0 do_compile:函数失败:do_compile(日志文件位于/path/to/test/1.0-r0/temp/log.do_compile.8532)
错误:故障日志文件存储在:/path/to/test/1.0-r0/temp/log.do_compile.8532中
日志数据如下:
|调试:执行shell函数do_compile
|回溯(最近一次呼叫最后一次):
|文件“/path/to/test-1.0/./test.py”,第1行,在
|导入设置工具
|ImportError:没有名为“setuptools”的模块
|警告:从shell命令中退出代码1。
|错误:函数失败:do_compile(日志文件位于/path/to/test/1.0-r0/temp/log.do_compile.8532)
错误:任务(/path/to/test.bb:do_compile)失败,退出代码为“1”
注意:任务摘要:尝试了400项任务,其中398项不需要重新运行,1项失败。
注:编写构建历史
摘要:1任务失败:
/path/to/test.bb:是否编译
摘要:显示1条错误消息,返回非零退出代码。

我的解释错了吗,
dependens+=“python3 setuptools native”
使python3模块“setuptools”可用于
do\u compile()
中的python3脚本?我如何才能做到这一点呢?

在引擎盖下,要获得working setuptools支持,还需要做更多的工作。幸运的是,有一个类可以处理这个问题:

inherit setuptools3
这就是使用OE核心打包基于setuptools的项目所需的全部内容。只要您的项目有一个标准的setup.py,就不需要编写任何do_compile()或do_install()函数

如果您确实需要查看详细信息,
meta/classes/setuptools3.bbclass
meta/classes/distutils3.bbclass
应该包含您需要的内容(包括从配方中调用本机python的不太明显的方式)