setup: Ensure target directory exists with building rust extension
When the rust extension is the first to be build, the target directory may not
exist so the copy fails.
--- a/setup.py Thu Jan 26 00:23:07 2023 +0100
+++ b/setup.py Sat Jan 28 20:08:57 2023 +0100
@@ -1454,11 +1454,13 @@
target = [target_dir]
target.extend(self.name.split('.'))
target[-1] += DYLIB_SUFFIX
+ target = os.path.join(*target)
+ os.makedirs(os.path.dirname(target), exist_ok=True)
shutil.copy2(
os.path.join(
self.rusttargetdir, self.dylibname + self.rustdylibsuffix()
),
- os.path.join(*target),
+ target,
)