python的任务自动化工具,类似于make、rake、ant或cook
Kook的Python项目详细描述
pykook是一个非常有用的工具,可以用来控制编译、安装或清理等任务。 pykook类似于make、rake、ant或cook。 py是pykook的任务定义文件,它是用python编写的。
kookbook.py的简单示例:
@recipe def hello(c): print("Hello")
输出结果:
bash> kk hello # or pykook hello ### * hello (recipe=hello) Hello
kookbook.py的其他示例:
CC = prop('CC', 'gcc -Wall') kookbook.default = 'all' @recipe @ingreds('hello') # ingredients def all(c): # or task_all(c) pass @recipe('*.o', ['$(1).c', '$(1).h']) # @recipe(product, [ingredients]) def file_o(c): """compile *.c and *.h into *.o""" system(c%'$(CC) -c $(ingred)') @recipe('hello', ['hello.o']) # @recipe(product, [ingredients]) def file_hello(c): """create 'hello' command""" system(c%'$(CC) -o $(product) $(ingred)') @recipe def clean(c): rm_rf("**/*.o", "**/*~") ## or kookbook.load('@kook/books/clean.py') # load 'clean' and 'sweep' recipes CLEAN.append("**/*.o")
有关详细信息,请参见User’s Guide。