1

My wscript file is simple:

def configure(ctx):
    pass

def build(bld):
    bld(rule='mkdir aaa', target='aaa')
    bld(rule='touch bbb', source='aaa', target='bbb')

And first run of waf configure and waf build passes OK. But the second waf build fails with an error:

source not found: 'aaa' in bld(source='aaa', target=['bbb'], meths=['process_rule', 'process_source'], features=[], path=/home/rnd/prj/prj2/prj-web, idx=2, tg_idx_count=2, rule='touch bbb', posted=True, _name='bbb') in /home/rnd/prj/prj2/prj-web

But if to change the "mkdir" to "touch" - everything works as expected. How to use a directory as a target? (PS. It would be interesting is it possible to use it as a source as well), because it's easy in a plain Makefile, so I had feeling that Waf can handle directories too.

RandomB
  • 3,367
  • 19
  • 30
  • Is it possible the issue is with `mkdir` itself which errors if the directory already exists? If you can use `mkdir -p` it does not error in that condition. – Amos Baker Aug 08 '22 at 19:15

1 Answers1

0

Well, the waf model don't manage directories with the source and target keywords. You can handle directories with specific keyword of your own, like source_dir and target_dir. Like :

def my_rule(task):
    tg = task.generator
    target_dir = tg.path.get_bld().make_node(target_dir)
    target_dir.mkdir()
bld(rule=my_rule, target=dir = "bbb")

neuro
  • 14,948
  • 3
  • 36
  • 59