fix(ci): treat sdist VCS-ignore files as optional in distribution check

hatchling 1.31.0 ships only .gitignore in the sdist; older releases also
bundled .hgignore. check_sdist required an exact member set including
.hgignore, so the Validate workflow's package job failed on main once CI
resolved the newer hatchling.

Require the tracked source set plus the fixed metadata files, and accept
.gitignore/.hgignore as optional members either way.
This commit is contained in:
Jack Nagy
2026-08-03 19:45:09 +01:00
parent 597a88ff25
commit 98e0020e2f
+6 -4
View File
@@ -81,16 +81,18 @@ def check_sdist(path: Path) -> None:
raise DistributionError("sdist must contain one top-level directory")
root = roots.pop()
relative = {name[len(root) + 1 :] for name in names if name.startswith(f"{root}/")}
expected = _tracked_files() | {
".gitignore",
".hgignore",
required = _tracked_files() | {
"LICENSE",
"PKG-INFO",
"README.md",
"pyproject.toml",
"smartthings_local/_version.py",
}
if relative != expected:
# hatchling bundles the VCS ignore files it finds, but which ones ship
# depends on the hatchling version (newer releases drop .hgignore), so
# treat them as optional rather than exact members.
optional = {".gitignore", ".hgignore"}
if not required <= relative <= required | optional:
raise DistributionError("sdist contents differ from the intended source set")