Skip to content

BUG: install_subdir() in meson.build does not honor exlude_files/directories #317

Closed
@dalcinl

Description

@dalcinl

I'm trying to use install_subdir() to simplify the inclusion of Python source files and other data files in the final wheel. However, the install_subdir() function is not honoring the exlude_files/directories options.

Core Meson is installing things properly and exclusions are honored. However, when mesonpy takes over, it ends up copying the subtree from the source directory, and not the install directory as I was expecting. That's the reason the exclusions are not honored: things are being copied from the wrong location. As Meson is all about out-of-tree builds, I would argue this is a bug.

The following trivial patch fixes the problem:

diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py
index 40b9645..fe5055d 100644
--- a/mesonpy/__init__.py
+++ b/mesonpy/__init__.py
@@ -486,7 +486,7 @@ class _WheelBuilder():
                 )
                 if install_details:
                     scheme, destination = install_details
-                    wheel_files[scheme].append((destination, file))
+                    wheel_files[scheme].append((destination, copy_files[file]))
                     continue
                 # not found
                 warnings.warn(

However, this patch makes some tests in tests/test_wheel.py break.
I'm not familiar enough with Meson and meson-python to triage these test failures. Is anyone able to help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependency-bugA bug experienced by users of meson-python caused by a dependency, rather than in code in this repo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions