From 7deeb293b684e6361fee28e1ec34adce693969b4 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 17 Jan 2022 22:38:25 -0500 Subject: wraps: on failure to apply a patch, delete the subproject directory This code path is only called on initial download of a subproject, but if we raise an error and abort while downloading/applying a patch overlay we still have the upstream sources extracted... which appears to be a subproject, then turns out to be broken due to missing meson.build Partially implements #9688 --- mesonbuild/wrap/wrap.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 80756af2d..24b0a4281 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -32,7 +32,7 @@ import textwrap from pathlib import Path from . import WrapMode from .. import coredata -from ..mesonlib import quiet_git, GIT, ProgressBar, MesonException +from ..mesonlib import quiet_git, GIT, ProgressBar, MesonException, windows_proof_rmtree from ..interpreterbase import FeatureNew from .. import mesonlib @@ -345,7 +345,11 @@ class Resolver: self.get_svn() else: raise WrapException(f'Unknown wrap type {self.wrap.type!r}') - self.apply_patch() + try: + self.apply_patch() + except: + windows_proof_rmtree(self.dirname) + raise # A meson.build or CMakeLists.txt file is required in the directory if method == 'meson' and not os.path.exists(meson_file): -- cgit v1.2.3