@@ -396,58 +396,6 @@ def _is_native(self, file: Union[str, pathlib.Path]) -> bool:
396
396
return True
397
397
return False
398
398
399
- def _warn_unsure_platlib (self , origin : pathlib .Path , destination : pathlib .Path ) -> None :
400
- """Warn if we are unsure if the file should be mapped to purelib or platlib.
401
-
402
- This happens when we use heuristics to try to map a file purelib or
403
- platlib but can't differentiate between the two. In which case, we place
404
- the file in platlib to be safe and warn the user.
405
-
406
- If we can detect the file is architecture dependent and indeed does not
407
- belong in purelib, we will skip the warning.
408
- """
409
- # {moduledir_shared} is currently handled in heuristics due to a Meson bug,
410
- # but we know that files that go there are supposed to go to platlib.
411
- if self ._is_native (origin ):
412
- # The file is architecture dependent and does not belong in puredir,
413
- # so the warning is skipped.
414
- return
415
- warnings .warn (
416
- 'Could not tell if file was meant for purelib or platlib, '
417
- f'so it was mapped to platlib: { origin } ({ destination } )' ,
418
- stacklevel = 2 ,
419
- )
420
-
421
- def _map_from_heuristics (self , origin : pathlib .Path , destination : pathlib .Path ) -> Optional [Tuple [str , pathlib .Path ]]:
422
- """Extracts scheme and relative destination with heuristics based on the
423
- origin file and the Meson destination path.
424
- """
425
- warnings .warn ('Using heuristics to map files to wheel, this may result in incorrect locations' )
426
- sys_paths = mesonpy ._introspection .SYSCONFIG_PATHS
427
- # Try to map to Debian dist-packages
428
- if mesonpy ._introspection .DEBIAN_PYTHON :
429
- search_path = origin
430
- while search_path != search_path .parent :
431
- search_path = search_path .parent
432
- if search_path .name == 'dist-packages' and search_path .parent .parent .name == 'lib' :
433
- calculated_path = origin .relative_to (search_path )
434
- warnings .warn (f'File matched Debian heuristic ({ calculated_path } ): { origin } ({ destination } )' )
435
- self ._warn_unsure_platlib (origin , destination )
436
- return 'platlib' , calculated_path
437
- # Try to map to the interpreter purelib or platlib
438
- for scheme in ('purelib' , 'platlib' ):
439
- # try to match the install path on the system to one of the known schemes
440
- scheme_path = pathlib .Path (sys_paths [scheme ]).absolute ()
441
- destdir_scheme_path = self ._install_dir / scheme_path .relative_to (scheme_path .anchor )
442
- try :
443
- wheel_path = pathlib .Path (origin ).relative_to (destdir_scheme_path )
444
- except ValueError :
445
- continue
446
- if sys_paths ['purelib' ] == sys_paths ['platlib' ]:
447
- self ._warn_unsure_platlib (origin , destination )
448
- return 'platlib' , wheel_path
449
- return None # no match was found
450
-
451
399
def _map_from_scheme_map (self , destination : str ) -> Optional [Tuple [str , pathlib .Path ]]:
452
400
"""Extracts scheme and relative destination from Meson paths.
453
401
@@ -475,15 +423,7 @@ def _map_to_wheel(
475
423
for file , details in files .items (): # install path -> {destination, tag}
476
424
# try mapping to wheel location
477
425
meson_destination = details ['destination' ]
478
- install_details = (
479
- # using scheme map
480
- self ._map_from_scheme_map (meson_destination )
481
- # using heuristics
482
- or self ._map_from_heuristics (
483
- pathlib .Path (copy_files [file ]),
484
- pathlib .Path (meson_destination ),
485
- )
486
- )
426
+ install_details = self ._map_from_scheme_map (meson_destination )
487
427
if install_details :
488
428
scheme , destination = install_details
489
429
wheel_files [scheme ].append ((destination , file ))
0 commit comments