From 1e9ca2f3f5cbbd1a28e1ed4410f0820052cb487f Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 2 Nov 2021 12:32:00 -0700 Subject: [PATCH] wrap: Fix concurrent os.mkdir() Since 0.59.0 Meson downloads multiple wraps in parallel, so the packagecache directory could be created by one then the 2nd would hit error when calling os.mkdir() because it already exists. --- mesonbuild/wrap/wrap.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 08da31922..aeb3add74 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -556,8 +556,7 @@ class Resolver: mlog.log('Using', mlog.bold(self.packagename), what, 'from cache.') return cache_path - if not os.path.isdir(self.cachedir): - os.mkdir(self.cachedir) + os.makedirs(self.cachedir, exist_ok=True) self.download(what, cache_path) return cache_path else: