Skip to content

Commit 7c20fcc

Browse files
committed
Ensure output directory exists before static link.
1 parent 56b45f5 commit 7c20fcc

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

setuptools/_distutils/_msvccompiler.py

+2
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ def create_static_lib(
467467
objects, output_dir = self._fix_object_args(objects, output_dir)
468468
output_filename = self.library_filename(output_libname, output_dir=output_dir)
469469

470+
os.makedirs(output_dir, exist_ok=True)
471+
470472
if self._need_link(objects, output_filename):
471473
lib_args = objects + ['/OUT:' + output_filename]
472474
if debug:

setuptools/_distutils/unixccompiler.py

+2
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ def create_static_lib(
215215

216216
output_filename = self.library_filename(output_libname, output_dir=output_dir)
217217

218+
os.makedirs(output_dir, exist_ok=True)
219+
218220
if self._need_link(objects, output_filename):
219221
self.mkpath(os.path.dirname(output_filename))
220222
self.spawn(self.archiver + [output_filename] + objects + self.objects)

0 commit comments

Comments
 (0)