Skip to content

Commit 6811eb5

Browse files
committed
Add support for Core Metadata 2.5 (PEP 794)
closes #1321
1 parent 275c161 commit 6811eb5

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

CHANGES/1321.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added support for Core Metadata 2.5 (PEP 794).

pulp_python/app/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
PYPI_LAST_SERIAL = "X-PYPI-LAST-SERIAL"
3131
"""TODO This serial constant is temporary until Python repositories implements serials"""
3232
PYPI_SERIAL_CONSTANT = 1000000000
33-
SUPPORTED_METADATA_VERSIONS = ("1.0", "1.1", "1.2", "2.0", "2.1", "2.2", "2.3", "2.4")
33+
SUPPORTED_METADATA_VERSIONS = ("1.0", "1.1", "1.2", "2.0", "2.1", "2.2", "2.3", "2.4", "2.5")
3434

3535
SIMPLE_API_VERSION = "1.1"
3636
PYPI_SIMPLE_V1_HTML = "application/vnd.pypi.simple.v1+html"

pulp_python/tests/functional/api/test_crud_content_unit.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from urllib.parse import urljoin
22

33
import pytest
4+
import requests
45
from pypi_simple import PyPISimple
56

67
from pulpcore.tests.functional.utils import PulpTaskError
@@ -182,6 +183,24 @@ def test_upload_metadata_24_spec(python_content_factory):
182183
assert content.license_file == '["LICENSE"]'
183184

184185

186+
@pytest.mark.parallel
187+
def test_legacy_upload_metadata_25(python_empty_repo_distro, python_package_dist_directory):
188+
"""Test that metadata_version 2.5 (PEP 794) is accepted via the legacy upload endpoint."""
189+
flit_url = get_package_url("flit", "flit-4.0.2-py3-none-any.whl")
190+
_, flit_file = python_package_dist_directory(flit_url)
191+
_, distro = python_empty_repo_distro()
192+
url = urljoin(distro.base_url, "legacy/")
193+
sha256 = "7b0b0038cd91a7f04e2e287d958dc5f25e68ffeed0b93e613bd50aec99a0d9ca"
194+
with open(flit_file, "rb") as f:
195+
response = requests.post(
196+
url,
197+
data={"sha256_digest": sha256, "metadata_version": "2.5"},
198+
files={"content": f},
199+
auth=("admin", "password"),
200+
)
201+
assert response.status_code == 202
202+
203+
185204
@pytest.mark.parallel
186205
def test_package_creation_with_metadata(
187206
pulp_content_url,

0 commit comments

Comments
 (0)