Skip to content

Commit af03ac3

Browse files
dnicolodirgommers
authored andcommitted
MAINT: make building the project explicit
1 parent 1d1a759 commit af03ac3

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

mesonpy/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,6 @@ def _wheel_write_metadata(self, whl: mesonpy._wheelfile.WheelFile) -> None:
452452
whl.write(self._license_file, f'{self.distinfo_dir}/{os.path.basename(self._license_file)}')
453453

454454
def build(self, directory: Path) -> pathlib.Path:
455-
# ensure project is built
456-
self._project.build()
457-
458455
wheel_file = pathlib.Path(directory, f'{self.name}.whl')
459456
with mesonpy._wheelfile.WheelFile(wheel_file, 'w') as whl:
460457
self._wheel_write_metadata(whl)
@@ -480,11 +477,7 @@ def build(self, directory: Path) -> pathlib.Path:
480477
return wheel_file
481478

482479
def build_editable(self, directory: Path, verbose: bool = False) -> pathlib.Path:
483-
# ensure project is built
484-
self._project.build()
485-
486480
wheel_file = pathlib.Path(directory, f'{self.name}.whl')
487-
488481
with mesonpy._wheelfile.WheelFile(wheel_file, 'w') as whl:
489482
self._wheel_write_metadata(whl)
490483
whl.writestr(
@@ -905,11 +898,13 @@ def sdist(self, directory: Path) -> pathlib.Path:
905898

906899
def wheel(self, directory: Path) -> pathlib.Path:
907900
"""Generates a wheel (binary distribution) in the specified directory."""
901+
self.build()
908902
file = self._wheel_builder.build(directory)
909903
assert isinstance(file, pathlib.Path)
910904
return file
911905

912906
def editable(self, directory: Path) -> pathlib.Path:
907+
self.build()
913908
file = self._wheel_builder.build_editable(directory, self._editable_verbose)
914909
assert isinstance(file, pathlib.Path)
915910
return file

0 commit comments

Comments
 (0)