From f942c5951fc3e315be112f8f01f364908a9318ef Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 3 May 2017 10:52:47 +0200 Subject: [PATCH] Move `_patch` method in `Source` class. The patch method is not specific to a `RealeaseDownload` source. --- dependency_utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dependency_utils.py b/dependency_utils.py index b26cd35..36e4932 100644 --- a/dependency_utils.py +++ b/dependency_utils.py @@ -82,6 +82,14 @@ class Source: def source_dir(self): return self.target.full_name + def _patch(self, context): + source_path = pj(self.buildEnv.source_dir, self.source_dir) + context.try_skip(source_path) + context.force_native_build = True + for p in self.patches: + with open(pj(SCRIPT_DIR, 'patches', p), 'r') as patch_input: + self.buildEnv.run_command("patch -p1", source_path, context, input=patch_input.read()) + def command(self, *args, **kwargs): return self.target.command(*args, **kwargs) @@ -105,13 +113,6 @@ class ReleaseDownload(Source): topdir=self.archive_top_dir, name=self.source_dir) - def _patch(self, context): - context.try_skip(self.extract_path) - context.force_native_build = True - for p in self.patches: - with open(pj(SCRIPT_DIR, 'patches', p), 'r') as patch_input: - self.buildEnv.run_command("patch -p1", self.extract_path, context, input=patch_input.read()) - def prepare(self): self.command('download', self._download) self.command('extract', self._extract)