From c2ad927f809056a4af8cc4e223e6d45ec5faec31 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 3 May 2017 10:54:02 +0200 Subject: [PATCH] Add a `SvnSource`. This is needed to get source from svn. --- dependency_utils.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dependency_utils.py b/dependency_utils.py index 36e4932..de6d82c 100644 --- a/dependency_utils.py +++ b/dependency_utils.py @@ -150,6 +150,33 @@ class GitClone(Source): self.command('post_prepare_script', self._post_prepare_script) +class SvnClone(Source): + @property + def source_dir(self): + return self.svn_dir + + @property + def svn_path(self): + return pj(self.buildEnv.source_dir, self.svn_dir) + + def _svn_checkout(self, context): + context.force_native_build = True + if os.path.exists(self.svn_path): + raise SkipCommand() + command = "svn checkout {} {}".format(self.svn_remote, self.svn_dir) + self.buildEnv.run_command(command, self.buildEnv.source_dir, context) + + def _svn_update(self, context): + context.force_native_build = True + self.buildEnv.run_command("svn update", self.svn_path, context) + + def prepare(self): + self.command('svncheckout', self._svn_checkout) + self.command('svnupdate', self._svn_update) + if hasattr(self, 'patches'): + self.command('patch', self._patch) + + class Builder: subsource_dir = None