diff --git a/python/build/project.py b/python/build/project.py index a1ea28bc6..183d87675 100644 --- a/python/build/project.py +++ b/python/build/project.py @@ -55,8 +55,8 @@ class Project: parent_path = toolchain.src_path else: parent_path = toolchain.build_path - path = untar(self.download(toolchain), parent_path, self.base) - + path = untar(self.download(toolchain), parent_path, self.base, + lazy=out_of_tree and self.patches is None) if self.patches is not None: push_all(toolchain, path, self.patches) diff --git a/python/build/tar.py b/python/build/tar.py index 7cb7db67c..e73ffdefa 100644 --- a/python/build/tar.py +++ b/python/build/tar.py @@ -1,7 +1,9 @@ import os, shutil, subprocess -def untar(tarball_path, parent_path, base): +def untar(tarball_path, parent_path, base, lazy=False): path = os.path.join(parent_path, base) + if lazy and os.path.isdir(path): + return path try: shutil.rmtree(path) except FileNotFoundError: