Skip to content

Commit 6d7a5dc

Browse files
dnicolodirgommers
authored andcommitted
MAINT: pass extra information for editable wheels to build_editable
This removes the last instances of the wheel builder having to access the project to build wheels.
1 parent af03ac3 commit 6d7a5dc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

mesonpy/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,14 +476,15 @@ def build(self, directory: Path) -> pathlib.Path:
476476

477477
return wheel_file
478478

479-
def build_editable(self, directory: Path, verbose: bool = False) -> pathlib.Path:
479+
def build_editable(self, directory: Path, source_dir: pathlib.Path, build_dir: pathlib.Path,
480+
build_command: List[str], verbose: bool = False) -> pathlib.Path:
481+
480482
wheel_file = pathlib.Path(directory, f'{self.name}.whl')
481483
with mesonpy._wheelfile.WheelFile(wheel_file, 'w') as whl:
482484
self._wheel_write_metadata(whl)
483485
whl.writestr(
484486
f'{self.distinfo_dir}/direct_url.json',
485-
self._source_dir.as_uri().encode('utf-8'),
486-
)
487+
source_dir.as_uri().encode('utf-8'))
487488

488489
# install loader module
489490
loader_module_name = f'_{self.normalized_name.replace(".", "_")}_editable_loader'
@@ -492,8 +493,8 @@ def build_editable(self, directory: Path, verbose: bool = False) -> pathlib.Path
492493
read_binary('mesonpy', '_editable.py') + textwrap.dedent(f'''
493494
install(
494495
{self.top_level_modules!r},
495-
{os.fspath(self._build_dir)!r},
496-
{self._project._build_command!r},
496+
{os.fspath(build_dir)!r},
497+
{build_command!r},
497498
{verbose!r},
498499
)''').encode('utf-8'))
499500

@@ -905,7 +906,7 @@ def wheel(self, directory: Path) -> pathlib.Path:
905906

906907
def editable(self, directory: Path) -> pathlib.Path:
907908
self.build()
908-
file = self._wheel_builder.build_editable(directory, self._editable_verbose)
909+
file = self._wheel_builder.build_editable(directory, self._source_dir, self._build_dir, self._build_command, self._editable_verbose)
909910
assert isinstance(file, pathlib.Path)
910911
return file
911912

0 commit comments

Comments
 (0)