MCPcopy Create free account
hub / github.com/HumbleUI/JWM / copy_replace

Function copy_replace

script/build_utils.py:78–87  ·  view source on GitHub ↗
(src, dst, replacements)

Source from the content-addressed store, hash-verified

76 return f.read()
77
78def copy_replace(src, dst, replacements):
79 original = slurp(src)
80 updated = original
81 for key, value in replacements.items():
82 updated = updated.replace(key, value)
83 makedirs(os.path.dirname(dst))
84 if updated != slurp(dst):
85 print("Writing", dst, flush=True)
86 with open(dst, 'w') as f:
87 f.write(updated)
88
89def copy_newer(src, dst):
90 if not os.path.exists(dst) or os.path.getmtime(src) > os.path.getmtime(dst):

Callers

nothing calls this directly

Calls 2

slurpFunction · 0.85
makedirsFunction · 0.85

Tested by

no test coverage detected