- Poetry version: 1.3.2
- Python version: 3.11.2
- OS version and name: Windows 11
- pyproject.toml: see below
Issue
Create a project as follows:
pyproject.toml:
[tool.poetry]
name = "poetry-test"
version = "0.1.0"
description = ""
authors = ["John Smith <john@example.com>"]
packages = [{include = "poetry_test"}]
[tool.poetry.dependencies]
python = "^3.11"
[tool.poetry.build]
generate-setup-file = true
script = "build.py"
[build-system]
requires = ["poetry-core", "setuptools"]
build-backend = "poetry.core.masonry.api"
build.py:
from setuptools import Extension
def build(setup_kwargs):
setup_kwargs['ext_modules'] = [
Extension(
name="poetry_test.test",
sources=["poetry_test/test.c"],
),
]
poetry_test\__init__.py: empty
poetry_test\test.c:
#define PY_SSIZE_T_CLEAN
#include <Python.h>
PyModuleDef def = {
PyModuleDef_HEAD_INIT,
"poetry_test.test",
"",
};
PyObject *PyInit_test(void) {
return PyModule_Create(&def);
}
Now build:
> poetry build
Preparing build environment with build-system requirements poetry-core, setuptoolsBuilding poetry-test (0.1.0)
running build
running build_py
creating C:\Users\dpb\Documents\Source\test\poetry-test\build
creating C:\Users\dpb\Documents\Source\test\poetry-test\build\lib.win-amd64-cpython-311
creating C:\Users\dpb\Documents\Source\test\poetry-test\build\lib.win-amd64-cpython-311\poetry_test
copying poetry_test\__init__.py -> C:\Users\dpb\Documents\Source\test\poetry-test\build\lib.win-amd64-cpython-311\poetry_test
copying poetry_test\test.c -> C:\Users\dpb\Documents\Source\test\poetry-test\build\lib.win-amd64-cpython-311\poetry_test
running build_ext
building 'poetry_test.test' extension
[...snipped...]
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.752.0_x64__qbz5n2kfra8p0\Lib\zipfile.py:1547: UserWarning: Duplicate name: 'poetry_test/test.c'
return self._open_to_write(zinfo, force_zip64=force_zip64)
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.752.0_x64__qbz5n2kfra8p0\Lib\zipfile.py:1547: UserWarning: Duplicate name: 'poetry_test/__init__.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
Note the warnings.
Now, examine the RECORD file inside the wheel:
> tar -xOf .\dist\poetry_test-0.1.0-cp311-cp311-win_amd64.whl poetry_test-0.1.0.dist-info/RECORD
poetry_test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
poetry_test/test.c,sha256=LV2Cw22u_-WHeTIx6r4_b8QOPSxRF_46zhXfV6HkUic,207
poetry_test/test.c,sha256=LV2Cw22u_-WHeTIx6r4_b8QOPSxRF_46zhXfV6HkUic,207
poetry_test/test.cp311-win_amd64.pyd,sha256=93EsxTSbGK32w4PIDSsKumB8e0HFoW7AMfvcibYfh80,10752
poetry_test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
poetry_test-0.1.0.dist-info/METADATA,sha256=FRvgZ3bDNIep0KQkK6KxJetccHVs-0NGTd7B8egelQE,243
poetry_test-0.1.0.dist-info/WHEEL,sha256=q-KLDJQebzIZyKLb3oMnX-cCkloRZtwcIVhfy70qOs8,98
poetry_test-0.1.0.dist-info/RECORD,,
As you can see, test.c and __init__.py are listed twice. This contradicts the spec:
The RECORD file holds the list of installed files. It is a CSV file containing one record (line) per installed file.
-vvvoption) and have included the output below.Issue
Create a project as follows:
pyproject.toml:build.py:poetry_test\__init__.py: emptypoetry_test\test.c:Now build:
Note the warnings.
Now, examine the
RECORDfile inside the wheel:As you can see,
test.cand__init__.pyare listed twice. This contradicts the spec: