PythonでRakeもどきを作ってみた

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    PythonでRakeもどきを作ってみた - Presentation Transcript

    1. 1
    2. 2
    3. Kookbook.py @recipe def clean(c): '''remove *.o files''' rm_rf("**/*.o") 3
    4. sh> kk clean sh> kk -l ### * clean (recipe=clean) Properties: $ rm -rf **/*.o Task recipes: clean : remove *.o File recipes: 4
    5. Kookbook.py @recipe @product('*.o') @ingreds('$(1).c', if_exists('$(1).h')) def file_o(c): '''compile *.c into *.o''' system(c%"gcc -c $(ingred)") 5
    6. hello X hello.o hello.c 6
    7. Kookbook.py @recipe @spices("-d: debug mode", "-p port: port number") def start(c, *args, **kwargs): debug = kwargs.get('d') # True or None port = kwargs.get("p", 8080) app = args and args[0] or 'helloworld' echo(c%"debug=$(debug), port=$(port), app=$(app)") ### : sh> kk start -dp 8080 helloworld 7
    8. mygit #!/usr/bin/env pykook -X kook_desc = "git helper" @recipe def ci(c): '''invokes git commit''' system("git commit -a") @recipe def co(c): '''invokes git clone''' system(c%"git clone $(url)") 8
    9. sh> ./mygit ci sh> ./mygit -h [master 773f3ba] comment mygit - git helper 1 files changed, 1 insertions(+), 0 deletions(-) sub-commands: ci : invokes git commit co : invokes git clone 9
    10. Kookbook.py CC = prop("CC", "gcc") cflags = prop("cflags", "") @recipe def build(c): system(c%"$(CC) $(cflags) hello.c") Properties.py cflags = "-g -Wall" 10
    11. with chdir('build'): system('...') # with # 11
    12. 12
    13. http://www.kuwata-lab.com/kook/pykook-users-guide.html 13
    14. 14
    SlideShare Zeitgeist 2009

    + kwatchkwatch Nominate

    custom

    160 views, 0 favs, 0 embeds more stats

    pyKook is a software build tool similar to Rake, Ma more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 160
      • 160 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories