comparison setup.py @ 49957:ff4df0954742

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.
author Cédric Krier <ced@b2ck.com>
date Sat, 28 Jan 2023 20:08:57 +0100
parents dd804d83822c
children 1bd33932713d
comparison
equal deleted inserted replaced
49956:2282d8ac0fa9 49957:ff4df0954742
1452 def build(self, target_dir): 1452 def build(self, target_dir):
1453 self.rustbuild() 1453 self.rustbuild()
1454 target = [target_dir] 1454 target = [target_dir]
1455 target.extend(self.name.split('.')) 1455 target.extend(self.name.split('.'))
1456 target[-1] += DYLIB_SUFFIX 1456 target[-1] += DYLIB_SUFFIX
1457 target = os.path.join(*target)
1458 os.makedirs(os.path.dirname(target), exist_ok=True)
1457 shutil.copy2( 1459 shutil.copy2(
1458 os.path.join( 1460 os.path.join(
1459 self.rusttargetdir, self.dylibname + self.rustdylibsuffix() 1461 self.rusttargetdir, self.dylibname + self.rustdylibsuffix()
1460 ), 1462 ),
1461 os.path.join(*target), 1463 target,
1462 ) 1464 )
1463 1465
1464 1466
1465 extmodules = [ 1467 extmodules = [
1466 Extension( 1468 Extension(