aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/wrap
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-01-17 22:38:25 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2022-01-18 16:47:05 +0200
commit7deeb293b684e6361fee28e1ec34adce693969b4 (patch)
treeffe51fa1aac3d115a157bd647c0a55ce900868a5 /mesonbuild/wrap
parent5c7f3b5bb86297e7be2adfd0b7ae86ea140fdde6 (diff)
downloadmeson-7deeb293b684e6361fee28e1ec34adce693969b4.zip
meson-7deeb293b684e6361fee28e1ec34adce693969b4.tar.gz
meson-7deeb293b684e6361fee28e1ec34adce693969b4.tar.bz2
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
Diffstat (limited to 'mesonbuild/wrap')
-rw-r--r--mesonbuild/wrap/wrap.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index 80756af..24b0a42 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):