in src/buildstream_plugins/sources/patch.py [0:0]
def stage(self, directory):
with self.timed_activity("Applying local patch: {}".format(self.path)):
# Bail out with a comprehensive message if the target directory is empty
if not os.listdir(directory):
raise SourceError(
"Nothing to patch in directory '{}'".format(directory),
reason="patch-no-files",
)
strip_level_option = "-p{}".format(self.strip_level)
self.call(
[
self.host_patch,
strip_level_option,
"-i",
self.fullpath,
"-d",
directory,
],
fail="Failed to apply patch {}".format(self.path),
)