0

I have my wscript file as:-

def build(bld):

    bld(
        rule = 'cp ${SRC} ${TGT}',
        source = 'a.txt',
        target = 'b.txt',
    )

By default, the output target is created inside the build directory build/b.txt, However, I want my target to be created inside the source directory where my current wscript file is. One method I tried is :-

def build(bld):

    bld(
        rule = 'cp ${SRC} b.txt',
        source = 'a.txt',
        cwd = './',
    )

This outputs b.txt inside the source directory relative to the current wscript file however the problem I face is that I lose the automatic dependency calculation or rebuilding as I'm not providing the target.

1 Answers1

0

I finally figured out a way how to do so. What we can do is pass the node object to the target.

def build(bld):

    bld(
        rule = 'cp ${SRC} ${TGT}',
        source = 'a.txt',
        target = bld.path.make_node('/path_you_want/b.txt')
    )