Skip to content

Commit 6dc3905

Browse files
dnicolodirgommers
authored andcommitted
ENH: do not run 'meson install' to produce a wheel
1 parent e361d29 commit 6dc3905

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

mesonpy/__init__.py

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -494,32 +494,27 @@ def build(self, directory: Path) -> pathlib.Path:
494494
# ensure project is built
495495
self._project.build()
496496

497-
# install project in temporary destination directory
498-
with tempfile.TemporaryDirectory() as destdir:
499-
self._project.install(destdir)
500-
501-
wheel_file = pathlib.Path(directory, f'{self.name}.whl')
502-
503-
with mesonpy._wheelfile.WheelFile(wheel_file, 'w') as whl:
504-
self._wheel_write_metadata(whl)
497+
wheel_file = pathlib.Path(directory, f'{self.name}.whl')
498+
with mesonpy._wheelfile.WheelFile(wheel_file, 'w') as whl:
499+
self._wheel_write_metadata(whl)
505500

506-
with mesonpy._util.cli_counter(sum(len(x) for x in self._wheel_files.values())) as counter:
501+
with mesonpy._util.cli_counter(sum(len(x) for x in self._wheel_files.values())) as counter:
507502

508-
root = 'purelib' if self.is_pure else 'platlib'
503+
root = 'purelib' if self.is_pure else 'platlib'
509504

510-
for path, entries in self._wheel_files.items():
511-
for dst, src in entries:
512-
counter.update(src)
505+
for path, entries in self._wheel_files.items():
506+
for dst, src in entries:
507+
counter.update(src)
513508

514-
if path == root:
515-
pass
516-
elif path == 'mesonpy-libs':
517-
# custom installation path for bundled libraries
518-
dst = pathlib.Path(f'.{self._project.name}.mesonpy.libs', dst)
519-
else:
520-
dst = pathlib.Path(self.data_dir, path, dst)
509+
if path == root:
510+
pass
511+
elif path == 'mesonpy-libs':
512+
# custom installation path for bundled libraries
513+
dst = pathlib.Path(f'.{self._project.name}.mesonpy.libs', dst)
514+
else:
515+
dst = pathlib.Path(self.data_dir, path, dst)
521516

522-
self._install_path(whl, src, dst)
517+
self._install_path(whl, src, dst)
523518

524519
return wheel_file
525520

@@ -812,11 +807,6 @@ def build(self) -> None:
812807
"""Build the Meson project."""
813808
self._run(self._build_command)
814809

815-
def install(self, destdir: Path) -> None:
816-
"""Install the Meson project."""
817-
destdir = os.fspath(destdir)
818-
self._run(['meson', 'install', '--quiet', '--no-rebuild', '--destdir', destdir, *self._meson_args['install']])
819-
820810
@functools.lru_cache()
821811
def _info(self, name: str) -> Any:
822812
"""Read info from meson-info directory."""

tests/test_project.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def wrapper(self, cmd):
122122
# wheel: calls to 'meson setup', 'meson compile', and 'meson install'
123123
['meson', 'setup'],
124124
['meson', 'compile'] if sys.platform == 'win32' else ['ninja'],
125-
['meson', 'install']
126125
]
127126

128127
# check that the user options are passed to the invoked commands

0 commit comments

Comments
 (0)