diff --git a/poetry/masonry/builders/wheel.py b/poetry/masonry/builders/wheel.py index 24efb2f7d7d..cdba38c51e3 100644 --- a/poetry/masonry/builders/wheel.py +++ b/poetry/masonry/builders/wheel.py @@ -153,7 +153,9 @@ def _copy_module(self, wheel): else: rel_file = file.relative_to(self._path) - if self.is_excluded(rel_file.as_posix()): + if self.is_excluded(rel_file.as_posix()) and isinstance( + include, PackageInclude + ): continue if file.suffix == ".pyc": diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/data2.txt b/tests/masonry/builders/fixtures/exclude_nested_data_toml/my_package/data/data2.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/masonry/builders/fixtures/exclude_nested_data_toml/pyproject.toml b/tests/masonry/builders/fixtures/exclude_nested_data_toml/pyproject.toml index 74c8cfbd190..28cff3c5414 100644 --- a/tests/masonry/builders/fixtures/exclude_nested_data_toml/pyproject.toml +++ b/tests/masonry/builders/fixtures/exclude_nested_data_toml/pyproject.toml @@ -10,6 +10,7 @@ license = "MIT" readme = "README.rst" exclude = ["**/data/", "**/*/item*"] +include = ["my_package/data/data2.txt"] homepage = "https://python-poetry.org/" repository = "https://github.com/python-poetry/poetry" diff --git a/tests/masonry/builders/test_sdist.py b/tests/masonry/builders/test_sdist.py index 4609c331990..7406af5b305 100644 --- a/tests/masonry/builders/test_sdist.py +++ b/tests/masonry/builders/test_sdist.py @@ -436,6 +436,7 @@ def test_src_excluded_nested_data(): assert "my-package-1.2.3/my_package/data/sub_data/data2.txt" not in names assert "my-package-1.2.3/my_package/data/sub_data/data3.txt" not in names assert "my-package-1.2.3/my_package/data/data1.txt" not in names + assert "my-package-1.2.3/my_package/data/data2.txt" in names assert "my-package-1.2.3/my_package/puplic/publicdata.txt" in names assert "my-package-1.2.3/my_package/public/item1/itemdata1.txt" not in names assert ( diff --git a/tests/masonry/builders/test_wheel.py b/tests/masonry/builders/test_wheel.py index 346da5256ae..ec3de8f7a60 100644 --- a/tests/masonry/builders/test_wheel.py +++ b/tests/masonry/builders/test_wheel.py @@ -93,6 +93,7 @@ def test_wheel_excluded_nested_data(): assert "my_package/data/sub_data/data2.txt" not in z.namelist() assert "my_package/data/sub_data/data3.txt" not in z.namelist() assert "my_package/data/data1.txt" not in z.namelist() + assert "my_package/data/data2.txt" in z.namelist() assert "my_package/puplic/publicdata.txt" in z.namelist() assert "my_package/public/item1/itemdata1.txt" not in z.namelist() assert "my_package/public/item1/subitem/subitemdata.txt" not in z.namelist()