Skip to content

Commit 52adafa

Browse files
committed
Create dist dir before packing wheels
Ensure the target dist directory exists before invoking the wheel packing step in SimplePackageBuilder and PythonPackageBuilder. Introduced a dist_dir variable (Path.cwd() / 'dist') and call dist_dir.mkdir(parents=True, exist_ok=True), then pass dist_dir to the pack command to avoid failures when the directory is missing and reduce repeated Path.cwd() calls.
1 parent 55a90f0 commit 52adafa

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/forge/build.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ def make_wheel(self):
632632

633633
# Re-pack the wheel file
634634
log(self.log_file, f"\n[{self.cross_venv}] Packing wheel")
635+
dist_dir = Path.cwd() / "dist"
636+
dist_dir.mkdir(parents=True, exist_ok=True)
635637
self.cross_venv.run(
636638
self.log_file,
637639
[
@@ -641,7 +643,7 @@ def make_wheel(self):
641643
"pack",
642644
str(self.build_path / "wheel"),
643645
"--dest-dir",
644-
str(Path.cwd() / "dist"),
646+
str(dist_dir),
645647
"--build-number",
646648
str(build_num),
647649
],
@@ -916,14 +918,16 @@ def _build(self):
916918

917919
# re-pack the wheel to "dist"
918920
log(self.log_file, f"\n[{self.cross_venv}] Packing wheel to dist")
921+
dist_dir = Path.cwd() / "dist"
922+
dist_dir.mkdir(parents=True, exist_ok=True)
919923
pack_args = [
920924
"build-python",
921925
"-m",
922926
"wheel",
923927
"pack",
924928
str(tmp_wheel_dir),
925929
"--dest-dir",
926-
str(Path.cwd() / "dist"),
930+
str(dist_dir),
927931
]
928932
if self.package.meta["build"]["number"]:
929933
pack_args.extend(

0 commit comments

Comments
 (0)