MCPcopy Index your code
hub / github.com/docker/docker-py / exclude_paths

Function exclude_paths

docker/utils/build.py:41–55  ·  view source on GitHub ↗

Given a root directory path and a list of .dockerignore patterns, return an iterator of all paths (both regular files and directories) in the root directory that do *not* match any of the patterns. All paths returned are relative to the root.

(root, patterns, dockerfile=None)

Source from the content-addressed store, hash-verified

39
40
41def exclude_paths(root, patterns, dockerfile=None):
42 """
43 Given a root directory path and a list of .dockerignore patterns, return
44 an iterator of all paths (both regular files and directories) in the root
45 directory that do *not* match any of the patterns.
46
47 All paths returned are relative to the root.
48 """
49
50 if dockerfile is None:
51 dockerfile = 'Dockerfile'
52
53 patterns.append(f"!{dockerfile}")
54 pm = PatternMatcher(patterns)
55 return set(pm.walk(root))
56
57
58def build_file_list(root):

Callers 7

excludeMethod · 0.90
test_no_dupesMethod · 0.90
test_include_wildcardMethod · 0.90
test_parent_directoryMethod · 0.90
tarFunction · 0.85

Calls 2

walkMethod · 0.95
PatternMatcherClass · 0.85

Tested by 6

excludeMethod · 0.72
test_no_dupesMethod · 0.72
test_include_wildcardMethod · 0.72
test_parent_directoryMethod · 0.72