MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / walk_build

Function walk_build

src/packagedcode/build.py:226–239  ·  view source on GitHub ↗

Walk the ``codebase`` starting at ``resource`` and stop when ``skip_name`` is found in a subdirectory. The idea is to avoid walking recursively sub- directories that contain a build script such as a Bazel or BUCK file as they define their own file tree.

(resource, codebase, skip_name)

Source from the content-addressed store, hash-verified

224
225
226def walk_build(resource, codebase, skip_name):
227 """
228 Walk the ``codebase`` starting at ``resource`` and stop when ``skip_name``
229 is found in a subdirectory. The idea is to avoid walking recursively sub-
230 directories that contain a build script such as a Bazel or BUCK file as they
231 define their own file tree.
232 """
233 for child in resource.children(codebase):
234 yield child
235 if not child.is_dir:
236 continue
237 if not any(r.name == skip_name for r in child.children(codebase)):
238 for subchild in walk_build(child, codebase, skip_name=skip_name):
239 yield subchild
240
241
242def get_license_detections_and_expression(package, resource, codebase):

Callers 1

Calls 1

childrenMethod · 0.45

Tested by

no test coverage detected