Publish: Ignore non-matching files (#8986)

Fixes #8944
This commit is contained in:
konsti 2024-11-13 12:58:28 +01:00 committed by GitHub
parent cb430b8d44
commit 926660aea0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 61 additions and 6 deletions

View file

@ -219,6 +219,8 @@ def build_project_at_version(
# Build the project
check_call([uv, "build"], cwd=project_root)
# Test that we ignore unknown any file.
project_root.joinpath("dist").joinpath(".DS_Store").touch()
return project_root
@ -290,6 +292,8 @@ def publish_project(target: str, uv: Path, client: httpx.Client):
expected_filenames = [path.name for path in project_dir.joinpath("dist").iterdir()]
# Ignore the gitignore file in dist
expected_filenames.remove(".gitignore")
# Ignore our test file
expected_filenames.remove(".DS_Store")
print(
f"\n=== 1. Publishing a new version: {project_name} {version} {publish_url} ==="
@ -311,7 +315,8 @@ def publish_project(target: str, uv: Path, client: httpx.Client):
):
raise RuntimeError(
f"PyPI re-upload of the same files failed: "
f"{output.count("Uploading")}, {output.count("already exists")}\n"
f"{output.count("Uploading")} != {len(expected_filenames)}, "
f"{output.count("already exists")} != 0\n"
f"---\n{output}\n---"
)
@ -335,7 +340,8 @@ def publish_project(target: str, uv: Path, client: httpx.Client):
):
raise RuntimeError(
f"Re-upload with check URL failed: "
f"{output.count("Uploading")}, {output.count("already exists")}\n"
f"{output.count("Uploading")} != 0, "
f"{output.count("already exists")} != {len(expected_filenames)}\n"
f"---\n{output}\n---"
)