Python 如何从Ant运行Pylint
我需要从ant运行此命令:Python 如何从Ant运行Pylint,python,ant,jenkins,continuous-integration,pylint,Python,Ant,Jenkins,Continuous Integration,Pylint,我需要从ant运行此命令: pylint -f parseable src/apps/api | tee pylint.out 它输出一个pylint.out文件 我试过这个: <target name="pylint" description="Pylint"> <exec executable="pylint"> <arg line="-f parseable src/apps/api | tee ${basedir}/pylint.o
pylint -f parseable src/apps/api | tee pylint.out
它输出一个pylint.out文件
我试过这个:
<target name="pylint" description="Pylint">
<exec executable="pylint">
<arg line="-f parseable src/apps/api | tee ${basedir}/pylint.out"/>
</exec>
</target>
但这不会生成pylint.out文件。有什么想法吗?看来ant会将管道(
|
)视为参数,而不是shell的命令
一种解决方案是将命令提取到脚本:
pylint.sh:
#!/bin/bash
pylint -f parseable src/apps/api | tee $1/pylint.out
<target name="pylint" description="Pylint">
<exec executable="pylint.sh">
<arg line="${basedir}"/>
</exec>
</target>
然后从
任务中运行该脚本:
build.xml:
#!/bin/bash
pylint -f parseable src/apps/api | tee $1/pylint.out
<target name="pylint" description="Pylint">
<exec executable="pylint.sh">
<arg line="${basedir}"/>
</exec>
</target>
如果需要,使其在Windows上工作。您需要在文件和标准输出中同时输出?