Skip to content

fix(packaging): include .config and .json data files in wheel - #124

Open
0x5t4l1n wants to merge 1 commit into
intel:mainfrom
0x5t4l1n:fix/include-config-files-in-wheel
Open

0x5t4l1n wants to merge 1 commit into
intel:mainfrom
0x5t4l1n:fix/include-config-files-in-wheel

Conversation

@0x5t4l1n

Copy link
Copy Markdown

Summary

Fixes #97.

Importing any xmlcli module that loads the config at import time (e.g. xmlcli.modules.nvram) raises configparser.NoSectionError: No section: 'GENERAL_SETTINGS' when xmlcli is installed from a wheel.

Root cause

The project uses poetry-core as its build backend ([build-system] in pyproject.toml). Poetry's build backend does not read setup.cfg or MANIFEST.in, so the non-Python data files (xmlcli.config, messages.json, everything under cfg/) are silently omitted from the wheel even though MANIFEST.in lists them for sdist builds.

Fix

Add an explicit include list to [tool.poetry] so Poetry bundles the required data files in both the sdist and the wheel:

[tool.poetry]
packages = [{include = "xmlcli", from = "src"}]
include = [
    {path = "src/xmlcli/xmlcli.config", format = ["sdist", "wheel"]},
    {path = "src/xmlcli/messages.json",  format = ["sdist", "wheel"]},
    {path = "src/xmlcli/cfg/**/*",       format = ["sdist", "wheel"]},
]

Verification

python -m build          # build the wheel
pip install dist/*.whl   # install from wheel
python -c "import xmlcli.modules.nvram"  # no longer raises NoSectionError

The build backend is poetry-core, which does not read setup.cfg or
MANIFEST.in. As a result, xmlcli.config and messages.json were absent
from the built wheel, causing a NoSectionError on import of any module
that reads the config at load time (e.g. xmlcli.modules.nvram).

Add an explicit 'include' list to [tool.poetry] so that:
  - src/xmlcli/xmlcli.config
  - src/xmlcli/messages.json
  - src/xmlcli/cfg/**  (all supporting config data)

are bundled in both the sdist and the wheel.

Fixes intel#97

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] xmlcli 2.2.6 doesn't include xmlcli.config when built as wheel

1 participant