[ANN] pyKook 0.0.3 - a smart build tool similar to Make, Rake, or Ant
kwatch
kwatch at gmail.com
Sun Aug 9 01:37:03 EDT 2009
Hi,
I have released pyKook 0.0.3.
http://pypi.python.org/pypi/Kook/0.0.3
http://www.kuwata-lab.com/kook/
http://www.kuwata-lab.com/kook/pykook-users-guide.html
In this release, recipe syntax is changed (see below).
Overview
========
pyKook is a smart build tool similar to Make, Rake, Ant, or Cook.
pyKook regards software project as cooking.
Terms used in pyKook are cooking terms.
For example:
cookbook - Makefile
product - target file
ingredient - source file
recipe - how to create target from source
spices - command-line options for recipe
Cookbook (= Makefile) is written in pure Python.
You can write any statements or expressions in cookbook.
NOTICE: pyKook is under alpha release. Spec and features may be
changed
in the future without previous announcement.
Example
=======
Example of cookbook (Kookbook.py):
--------------------------------------------------
##
## properties
##
cc = prop('cc', 'gcc')
cflags = prop('cflags', '-g -Wall')
##
## recipes
##
@recipe
@ingreds("hello")
def all(c): # or task_all(c)
pass
@recipe
@product("hello")
@ingreds("hello.o")
def file_command(c):
"""generates hello command"""
system(c%"$(cc) $(cflags) -o $(product) $(ingred)")
@recipe
@product("*.o")
@ingreds("$(1).c", if_exists("$(1).h"))
def file_ext_o(c):
"""compile '*.c' and '*.h'"""
system(c%"$(cc) $(cflags) -c $(1).c")
@recipe
def clean(c):
rm_f("*.o")
--------------------------------------------------
Exampe of result:
--------------------------------------------------
bash> ls
Kookbook.py hello.c hello.h
bash> pykook -l
Properties:
cc : 'gcc'
cflags : '-g -Wall'
Task recipes:
all : cook all products
clean : remove by-products
File recipes:
hello : generates hello command
*.o : compile '*.c' and '*.h'
(Tips: you can set 'kook_default_product' variable in your
kookbook.)
bash> pykook all # or, pykook --cc=gcc4 all
### *** hello.o (func=file_ext_o)
$ gcc -g -Wall -c hello.c
### ** hello (func=file_command)
$ gcc -g -Wall -o hello hello.o
### * all (func=task_all)
--------------------------------------------------
See users-guide for more details.
http://www.kuwata-lab.com/kook/pykook-users-guide.html
Enhancements, Changes, Bug fixes sice 0.0.2
===========================================
Changes
-------
- IMPORTANT!!
New '@recipe' decorator is required for each recipe function.
If function is decorated by '@recipe', 'task_' prefix is not
necessary.
ex:
## previous version
def task_clean(c): # 'task_' prefix is required
rm_rf("*.o")
## since this release
@release # @release decorator is required
def clean(c): # 'task_' prefix is not necessary
rm_rf("*.o")
See http://www.kuwata-lab.com/kook/pykook-users-guide.html#cookbook-recipekind
for details.
- Library codes are much refactored.
Enhancements
------------
- IMPORTANT!!
New feature to support command-line script framework.
You can convert Kookbook.py into command-line script.
See http://www.kuwata-lab.com/kook/pykook-users-guide.html#topic-framework
for details.
- New command-line option '-n' (no exec) supported.
If you specify '-n', commands such as 'cp()' or 'rm()' are not
executed.
In other words, '-n' means 'dry-run'.
- Add a lot of test scripts.
Bug fixes
---------
- A bug related timestamp detection is now fixed.
There was a case that product file was not updated even when
ingredient files were updated.
- A bug about recipe tree is fixed. There was a case that the same
recipe
can be invoke more than once when an intermediate recipe was
required
from several recipes.
Have fun!
--
regards,
makoto kuwata
More information about the Python-list
mailing list