Skip to content

Commit 9a089d4

Browse files
authored
mkdir when destination directory doesn't exist (#9055)
* mkdir when destination directory doesn't exist Fixes #8980 Make sure we mkdir if destination directory doesn't exist. I have no idea why it doesn't work before [ghstack-poisoned] * Update on "mkdir when destination directory doesn't exist" Fixes #8980 Make sure we mkdir if destination directory doesn't exist. I have no idea why it doesn't work before cc lucylq [ghstack-poisoned]
1 parent 6099020 commit 9a089d4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ def build_extension(self, ext: _BaseExtension) -> None:
463463
dst_file: Path = ext.dst_path(self)
464464

465465
# Ensure that the destination directory exists.
466-
self.mkpath(os.fspath(dst_file.parent))
466+
if not dst_file.parent.exists():
467+
self.mkpath(os.fspath(dst_file.parent))
467468

468469
# Copy the file.
469470
self.copy_file(os.fspath(src_file), os.fspath(dst_file))

0 commit comments

Comments
 (0)