@@ -397,22 +397,6 @@ def _stable_abi(self) -> Optional[str]:
397
397
return 'abi3'
398
398
return None
399
399
400
- @property
401
- def top_level_modules (self ) -> Collection [str ]:
402
- modules = set ()
403
- for type_ in self ._manifest :
404
- for path , _ in self ._manifest [type_ ]:
405
- name , dot , ext = path .parts [0 ].partition ('.' )
406
- if dot :
407
- # module
408
- suffix = dot + ext
409
- if suffix in _SUFFIXES :
410
- modules .add (name )
411
- else :
412
- # package
413
- modules .add (name )
414
- return modules
415
-
416
400
def _install_path (self , wheel_file : mesonpy ._wheelfile .WheelFile , origin : Path , destination : pathlib .Path ) -> None :
417
401
"""Add a file to the wheel."""
418
402
@@ -470,8 +454,27 @@ def build(self, directory: Path) -> pathlib.Path:
470
454
471
455
return wheel_file
472
456
473
- def build_editable (self , directory : Path , source_dir : pathlib .Path , build_dir : pathlib .Path ,
474
- build_command : List [str ], verbose : bool = False ) -> pathlib .Path :
457
+
458
+ class _EditableWheelBuilder (_WheelBuilder ):
459
+
460
+ @property
461
+ def _top_level_modules (self ) -> Collection [str ]:
462
+ modules = set ()
463
+ for type_ in self ._manifest :
464
+ for path , _ in self ._manifest [type_ ]:
465
+ name , dot , ext = path .parts [0 ].partition ('.' )
466
+ if dot :
467
+ # module
468
+ suffix = dot + ext
469
+ if suffix in _SUFFIXES :
470
+ modules .add (name )
471
+ else :
472
+ # package
473
+ modules .add (name )
474
+ return modules
475
+
476
+ def build (self , directory : Path , source_dir : pathlib .Path , build_dir : pathlib .Path , # type: ignore[override]
477
+ build_command : List [str ], verbose : bool = False ) -> pathlib .Path :
475
478
476
479
wheel_file = pathlib .Path (directory , f'{ self .name } .whl' )
477
480
with mesonpy ._wheelfile .WheelFile (wheel_file , 'w' ) as whl :
@@ -486,7 +489,7 @@ def build_editable(self, directory: Path, source_dir: pathlib.Path, build_dir: p
486
489
f'{ loader_module_name } .py' ,
487
490
read_binary ('mesonpy' , '_editable.py' ) + textwrap .dedent (f'''
488
491
install(
489
- { self .top_level_modules !r} ,
492
+ { self ._top_level_modules !r} ,
490
493
{ os .fspath (build_dir )!r} ,
491
494
{ build_command !r} ,
492
495
{ verbose !r} ,
@@ -882,14 +885,14 @@ def sdist(self, directory: Path) -> pathlib.Path:
882
885
def wheel (self , directory : Path ) -> pathlib .Path :
883
886
"""Generates a wheel in the specified directory."""
884
887
self .build ()
885
- builder = _WheelBuilder (self ._metadata , self ._manifest , self ._is_pure , self . _limited_api )
888
+ builder = _WheelBuilder (self ._metadata , self ._manifest , self ._limited_api )
886
889
return builder .build (directory )
887
890
888
891
def editable (self , directory : Path ) -> pathlib .Path :
889
892
"""Generates an editable wheel in the specified directory."""
890
893
self .build ()
891
- builder = _WheelBuilder (self ._metadata , self ._manifest , self . _is_pure , self ._limited_api )
892
- return builder .build_editable (directory , self ._source_dir , self ._build_dir , self ._build_command , self ._editable_verbose )
894
+ builder = _EditableWheelBuilder (self ._metadata , self ._manifest , self ._limited_api )
895
+ return builder .build (directory , self ._source_dir , self ._build_dir , self ._build_command , self ._editable_verbose )
893
896
894
897
895
898
@contextlib .contextmanager
0 commit comments