[PYTHON] Automated detection of build directory in waf

In the build process, bld.cur_script is set as a running script node. We can use bld.cur_script to detect building directory.

bld.cur_script.relpath() # Returns relative path from root waf script

I add handy function to bld object as below.

def build(bld):
  def add_prefix(bld, path):
    return os.path.join(os.path.dirname(bld.cur_script.relpath()), str(path))

  bld.add_prefix = functools.partial(add_prefix, bld)
  bld.recurse('dir1 dir2 ... dir3')

Recommended Posts

Automated detection of build directory in waf
Calculation of mean IoU in object detection
Detection of ArUco markers
[Note] Import of a file in the parent directory in Python
Comparison of color detection methods in OpenCV inRange, numpy, cupy