code: def find_hwpack_dir(root):
      
      root = path(root)
      log.debug('files in dir: %s', root)
      for x in root.walkfiles():
          log.debug('  %s', x)
  
      hwpack_dir = None
      for h in (root.walkfiles('boards.txt')):
          assert not hwpack_dir
          hwpack_dir = h.parent
          log.debug('found hwpack: %s', hwpack_dir)
  
      assert hwpack_dir
      return hwpack_dir
docs: search for hwpack dir under root.