@@ -505,7 +505,7 @@ def __init__(self, dist: Distribution, name: str):
505
505
self .dist = dist
506
506
self .name = name
507
507
508
- def __call__ (self , wheel : "WheelFile" , files : List [str ], mapping : Dict [str , str ]) :
508
+ def template_vars (self ) -> Tuple [ str , str , Dict [str , str ], Dict [str , List [ str ]]] :
509
509
src_root = self .dist .src_root or os .curdir
510
510
top_level = chain (_find_packages (self .dist ), _find_top_level_modules (self .dist ))
511
511
package_dir = self .dist .package_dir or {}
@@ -519,7 +519,7 @@ def __call__(self, wheel: "WheelFile", files: List[str], mapping: Dict[str, str]
519
519
)
520
520
521
521
legacy_namespaces = {
522
- pkg : find_package_path (pkg , roots , self .dist .src_root or "" )
522
+ cast ( str , pkg ) : find_package_path (pkg , roots , self .dist .src_root or "" )
523
523
for pkg in self .dist .namespace_packages or []
524
524
}
525
525
@@ -530,11 +530,20 @@ def __call__(self, wheel: "WheelFile", files: List[str], mapping: Dict[str, str]
530
530
531
531
name = f"__editable__.{ self .name } .finder"
532
532
finder = _normalization .safe_identifier (name )
533
+ return finder , name , mapping , namespaces_
534
+
535
+ def get_implementation (self ) -> Iterator [Tuple [str , bytes ]]:
536
+ finder , name , mapping , namespaces_ = self .template_vars ()
537
+
533
538
content = bytes (_finder_template (name , mapping , namespaces_ ), "utf-8" )
534
- wheel . writestr (f"{ finder } .py" , content )
539
+ yield (f"{ finder } .py" , content )
535
540
536
541
content = _encode_pth (f"import { finder } ; { finder } .install()" )
537
- wheel .writestr (f"__editable__.{ self .name } .pth" , content )
542
+ yield (f"__editable__.{ self .name } .pth" , content )
543
+
544
+ def __call__ (self , wheel : "WheelFile" , files : List [str ], mapping : Dict [str , str ]):
545
+ for file , content in self .get_implementation ():
546
+ wheel .writestr (file , content )
538
547
539
548
def __enter__ (self ):
540
549
msg = "Editable install will be performed using a meta path finder.\n "
0 commit comments