用Makefile执行的Python脚本 [英] Python Script Executed with Makefile
问题描述
我正在编写python脚本,并在Makefile中执行它们.python脚本用于处理管道中的数据.我希望Makefile每次更改python脚本时都执行脚本.
I am writing python scripts and execute them in a Makefile. The python script is used to process data in a pipeline. I would like Makefile to execute the script every time I make a change to my python scripts.
有人知道怎么做吗?
推荐答案
信息不多,所以这个答案有点含糊.Makefile的基本原理是列出每个目标的依赖性.在这种情况下,您的目标(我们将其称为foo)取决于您的python脚本(我们将其称为do-foo.py):
That's not a lot of information, so this answer is a bit vague. The basic principle of Makefiles is to list dependencies for each target; in this case, your target (let's call it foo) depends on your python script (let's call it do-foo.py):
foo: do-foo.py
python do-foo.py > foo
现在,只要do-foo.py发生更改,foo就会重新运行(当然,前提是您要调用make).
Now foo will be rerun whenever do-foo.py changes (provided, of course, you call make).
这篇关于用Makefile执行的Python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!