返回错误“OSError:没有这样的文件或目录”。我们试图使用builder中的步骤激活我们新创建的虚拟env venvCIshellCommand。似乎就好像我们不能激活virtualenv venvCI一样。在这种环境下才刚开始,所以请帮忙我们。谢谢. 在
from buildbot.steps.shell import ShellCommand
factory = util.BuildFactory()
# STEPS for example-slave:
factory.addStep(ShellCommand(command=['virtualenv', 'venvCI']))
factory.addStep(ShellCommand(command=['source', 'venvCI/bin/activate']))
factory.addStep(ShellCommand(command=['pip', 'install', '-r','development.pip']))
factory.addStep(ShellCommand(command=['pyflakes', 'calculator.py']))
factory.addStep(ShellCommand(command=['python', 'test.py']))
c['builders'] = []
c['builders'].append(
util.BuilderConfig(name="runtests",
slavenames=["example-slave"],
factory=factory))
由于buildsystem为每个Shell命令创建一个新的Shell,您不能
source env/bin/activate
,因为这只会修改活动Shell的环境。当Shell(命令)退出时,环境就消失了。在你可以做的事情:
为每个shell命令手动提供环境(读什么
activate
做)env={...}
创建一个运行所有命令的bash脚本 一个shell(我在其他系统中所做的)
例如
在myscript.sh公司名称:
建筑机器人:
^{pr2}$blog post about the issue
另一个选择是在虚拟环境中直接调用python可执行文件,因为许多提供命令行命令的python工具通常都可以作为模块执行:
然而,过了一段时间,这确实会让人厌烦。您可以使用
^{pr2}$string.Template
生成辅助对象:然后你可以这样做:
这些是一些开始的想法。请注意,
shlex
的一个妙处是,在进行拆分时,它将考虑带引号的字符串内的空格。在相关问题 更多 >
编程相关推荐