Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling a python script from a Jamfile

Tags:

python

jam

I would like to call a python script from a Jamfile to generate a necessary source file.

In a Makefile, it would look somewhat like this:

sourcefile.c:
    python script.py

What is the most elegant way to archive something like this in a Jamfile?

like image 340
user1785730 Avatar asked Sep 25 '26 23:09

user1785730


1 Answers

The jam equivalent is this:

actions CallScript
{
    python script.py
}

CallScript sourcefile.c ;

Depending on the context of your application, you might need to do a bit more. E.g. if the script generates the source file and you want to compile that generated source file, the solution would probably look like:

rule GenerateSource
{
    local source = [ FGristFiles $(1) ] ;
    MakeLocate $(source) : $(LOCATE_SOURCE) ;
    Clean clean : $(source) ;
    GenerateSource1 $(source) ;
}

actions GenerateSource1
{
    python script.py $(1)
}

GenerateSource sourcefile.c ;

Main foo : sourcefile.c ;
like image 159
user686249 Avatar answered Sep 28 '26 12:09

user686249



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!