diff --git a/poetry/core/masonry/builders/builder.py b/poetry/core/masonry/builders/builder.py index 04f12252c..513c26960 100644 --- a/poetry/core/masonry/builders/builder.py +++ b/poetry/core/masonry/builders/builder.py @@ -53,7 +53,13 @@ def __init__( packages = [] for p in self._package.packages: - formats = p.get("format", []) + formats = p.get("format") or None + + # Default to including the package in both sdist & wheel + # if the `format` key is not provided in the inline include table. + if formats is None: + formats = ["sdist", "wheel"] + if not isinstance(formats, list): formats = [formats] diff --git a/tests/masonry/builders/fixtures/with_include_inline_table/both.txt b/tests/masonry/builders/fixtures/with_include_inline_table/both.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/masonry/builders/fixtures/with_include_inline_table/pyproject.toml b/tests/masonry/builders/fixtures/with_include_inline_table/pyproject.toml index 95b0949c6..5309992f1 100644 --- a/tests/masonry/builders/fixtures/with_include_inline_table/pyproject.toml +++ b/tests/masonry/builders/fixtures/with_include_inline_table/pyproject.toml @@ -24,6 +24,7 @@ packages = [ include = [ { path = "tests", format = "sdist" }, + { path = "both.txt" }, { path = "wheel_only.txt", format = "wheel" } ] diff --git a/tests/masonry/builders/test_sdist.py b/tests/masonry/builders/test_sdist.py index 3cb2a3b12..b67be206c 100644 --- a/tests/masonry/builders/test_sdist.py +++ b/tests/masonry/builders/test_sdist.py @@ -529,6 +529,7 @@ def test_includes_with_inline_table(): assert sdist.exists() with tarfile.open(str(sdist), "r") as tar: + assert "with-include-1.2.3/both.txt" in tar.getnames() assert "with-include-1.2.3/wheel_only.txt" not in tar.getnames() assert "with-include-1.2.3/tests/__init__.py" in tar.getnames() assert "with-include-1.2.3/tests/test_foo/test.py" in tar.getnames() diff --git a/tests/masonry/builders/test_wheel.py b/tests/masonry/builders/test_wheel.py index 3db7c04d4..9a54ea9f2 100644 --- a/tests/masonry/builders/test_wheel.py +++ b/tests/masonry/builders/test_wheel.py @@ -182,6 +182,7 @@ def test_wheel_includes_inline_table(): assert whl.exists() with zipfile.ZipFile(str(whl)) as z: + assert "both.txt" in z.namelist() assert "wheel_only.txt" in z.namelist() assert "notes.txt" not in z.namelist()