Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the variant_dir path from inside a Builder()?

Tags:

scons

I'm writing a custom Builder. Is there any way from inside the Builder to get the root path of the variant_dir it's building in?

Maybe a property on env?

Or maybe from a target node? For example, if in my Builder I have:

target[0].path --> path_to/my_variant_dir/subdir/target_file.txt

Is there a way to determine which part is the variant_dir path?

'path_to/my_variant_dir'
like image 759
Joshua Avatar asked Oct 11 '25 20:10

Joshua


1 Answers

You specify the variant dir in the call to SConscript() so you can just store it on the env and retrieve it later. Ive actually done this before for a different reason, like this:

var_dir = 'some_dir'
env['variant_dir'] = var_dir

SConscript('subdir/SConscript', variant_dir = env['variant_dir'], duplicate = 0)
...

def yourBuilderFunc(target, source, env):
   # variant_dir is env['variant_dir']
like image 198
Brady Avatar answered Oct 15 '25 10:10

Brady