Wanted: Python solution for ordering dependencies
Makoto Kuwata
kwa at kuwata-lab.com
Sun Apr 25 08:46:06 EDT 2010
On Sun, Apr 25, 2010 at 5:53 AM, Jonathan Fine <jfine at pytex.org> wrote:
> I'm hoping to avoid reinventing a wheel (or other rolling device). I've got
> a number of dependencies and, if possible, I want to order them so that each
> item has its dependencies met before it is processed.
>
> I think I could get what I want by writing and running a suitable makefile,
> but that seems to be such a kludge.
>
> Does anyone know of an easily available Python solution?
If you are looking for alternatives of Make or Ant, try pyKook.
pyKook is a pure-Python tool similar to Make, Ant, or Rake.
http://www.kuwata-lab.com/kook/pykook-users-guide.html
http://pypi.python.org/pypi/Kook/
example (Kookbook.py):
CC = prop('CC', 'gcc')
CFLAGS = prop('CFLAGS', '-g -O2')
@recipe
@ingreds('hello.o')
def task_all(c):
"""compile all *.o""" # recipe description
pass
@recipe
@product("*.o")
@ingreds("$(1).c", if_exists("$(1).h"))
def file_o(c):
"""compile '*.c' and '*.h' into '*.o'""" # recipe description
system(c%"$(CC) $(CFLAGS) -c $(ingred)")
example of command-line:
~/tmp> kk all
### ** hello.o (recipe=file_o)
$ gcc -g -O2 -c hello.c
### * all (recipe=task_all)
--
regards,
makoto kuwata
More information about the Python-list
mailing list