Skip to content

Commit 2b6c9a2

Browse files
committed
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-source-id: 2467d12 Pull Request resolved: #9055
1 parent 6099020 commit 2b6c9a2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,11 @@ 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))
467-
466+
if not dst_file.parent.exists():
467+
print(f"DEBUG 1: dest parent directory {dst_file.parent}, exists? {dst_file.parent.exists()}")
468+
self.mkpath(os.fspath(dst_file.parent))
469+
print(f"DEBUG 2: dest parent directory {dst_file.parent}, exists? {dst_file.parent.exists()}")
470+
468471
# Copy the file.
469472
self.copy_file(os.fspath(src_file), os.fspath(dst_file))
470473

0 commit comments

Comments
 (0)