Skip to content

Commit

Permalink
mesonpy: minor wheel builder documentation enhancement
Browse files Browse the repository at this point in the history
Signed-off-by: Filipe Laíns <lains@riseup.net>
  • Loading branch information
FFY00 committed May 6, 2022
1 parent 718f4ec commit 62d08c1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mesonpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def data_dir(self) -> str:

@property
def wheel(self) -> bytes: # noqa: F811
'''dist-info WHEEL.'''
'''Return WHEEL file for dist-info.'''
return textwrap.dedent('''
Wheel-Version: 1.0
Generator: meson
Expand All @@ -173,6 +173,7 @@ def wheel(self) -> bytes: # noqa: F811

@property
def _debian_python(self) -> bool:
"""Check if we are running on Debian-patched Python."""
try:
import distutils
try:
Expand All @@ -197,6 +198,9 @@ def _warn_unsure_platlib(self, origin: str, destination: pathlib.Path) -> None:
)

def _map_from_heuristics(self, origin: str, destination: pathlib.Path) -> Optional[Tuple[str, pathlib.Path]]:
"""Extracts scheme and relative destination with heuristics based on the
origin file and the Meson destination path.
"""
warnings.warn('Using heuristics to map files to wheel, this may result in incorrect locations')
sys_vars = sysconfig.get_config_vars()
sys_vars['base'] = sys_vars['platbase'] = sys.base_prefix
Expand Down Expand Up @@ -228,6 +232,10 @@ def _map_from_heuristics(self, origin: str, destination: pathlib.Path) -> Option
return None

def _map_from_scheme_map(self, destination: str) -> Optional[Tuple[str, pathlib.Path]]:
"""Extracts scheme and relative destination from Meson paths.
Eg. {bindir}/foo/bar -> (scripts, foo/bar)
"""
for scheme, placeholder in [
(scheme, placeholder)
for scheme, placeholders in self._SCHEME_MAP.items()
Expand All @@ -243,6 +251,7 @@ def _map_to_wheel(
sources: Dict[str, Dict[str, Any]],
copy_files: Dict[str, str],
) -> DefaultDict[str, List[Tuple[pathlib.Path, str]]]:
"""Map files to the wheel, organized by scheme."""
relative_destination: Optional[pathlib.Path]
wheel_files = collections.defaultdict(list)
for files in sources.values(): # entries in intro-install_plan.json
Expand Down

0 comments on commit 62d08c1

Please sign in to comment.