diff --git a/pulp_python/app/pypi/views.py b/pulp_python/app/pypi/views.py index f6695ab6..f567e8b9 100644 --- a/pulp_python/app/pypi/views.py +++ b/pulp_python/app/pypi/views.py @@ -23,7 +23,7 @@ from packaging.utils import canonicalize_name from urllib.parse import urljoin, urlparse, urlunsplit from pathlib import PurePath -from pypi_simple.parse_stream import parse_links_stream_response +from pypi_simple import parse_links_stream_response from pulpcore.plugin.viewsets import OperationPostponedResponse from pulpcore.plugin.tasking import dispatch diff --git a/pulp_python/app/tasks/sync.py b/pulp_python/app/tasks/sync.py index 1293c613..c53e0564 100644 --- a/pulp_python/app/tasks/sync.py +++ b/pulp_python/app/tasks/sync.py @@ -23,7 +23,7 @@ PythonRemote, ) from pulp_python.app.utils import parse_metadata, PYPI_LAST_SERIAL -from pypi_simple import parse_repo_index_page +from pypi_simple import IndexPage from bandersnatch.mirror import Mirror from bandersnatch.master import Master @@ -226,7 +226,7 @@ async def determine_packages_to_sync(self): downloader = self.python_stage.remote.get_downloader(url=url) result = await downloader.run() with open(result.path) as f: - index = parse_repo_index_page(f.read()) + index = IndexPage.from_html(f.read()) self.packages_to_sync.update({p: 0 for p in index.projects}) self.target_serial = result.headers.get(PYPI_LAST_SERIAL, 0) diff --git a/pulp_python/tests/functional/api/test_full_mirror.py b/pulp_python/tests/functional/api/test_full_mirror.py index c14c145c..2f438009 100644 --- a/pulp_python/tests/functional/api/test_full_mirror.py +++ b/pulp_python/tests/functional/api/test_full_mirror.py @@ -7,7 +7,7 @@ PYTHON_XS_FIXTURE_CHECKSUMS, ) -from pypi_simple import parse_repo_project_response +from pypi_simple import ProjectPage from urllib.parse import urljoin, urlsplit @@ -44,15 +44,14 @@ def test_pull_through_simple(python_remote_factory, python_distribution_factory, distro = python_distribution_factory(remote=remote.pulp_href) url = f"{distro.base_url}simple/shelf-reader/" - project_page = parse_repo_project_response("shelf-reader", requests.get(url)) + project_page = ProjectPage.from_response(requests.get(url), "shelf-reader") assert len(project_page.packages) == 2 for package in project_page.packages: assert package.filename in PYTHON_XS_FIXTURE_CHECKSUMS relative_path = f"{distro.base_path}/{package.filename}?redirect=" assert urljoin(pulp_content_url, relative_path) in package.url - digests = package.get_digests() - assert PYTHON_XS_FIXTURE_CHECKSUMS[package.filename] == digests["sha256"] + assert PYTHON_XS_FIXTURE_CHECKSUMS[package.filename] == package.digests["sha256"] @pytest.mark.parallel @@ -65,7 +64,7 @@ def test_pull_through_with_repo( distro = python_distribution_factory(repository=repo.pulp_href, remote=remote.pulp_href) url = urljoin(distro.base_url, "simple/shelf-reader/") - project_page = parse_repo_project_response("shelf-reader", requests.get(url)) + project_page = ProjectPage.from_response(requests.get(url), "shelf-reader") assert len(project_page.packages) == 2 for package in project_page.packages: diff --git a/requirements.txt b/requirements.txt index 6617b434..c99e1c3d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ pulpcore>=3.49.0,<3.70.0 pkginfo>=1.10.0,<1.12.0 # Twine has <1.11 in their requirements -bandersnatch>=6.1,<6.2 -pypi-simple>=0.9.0,<1.0.0 +bandersnatch>=6.3,<7.0 # Anything >6.3 requires Python 3.10+ +pypi-simple>=1.5.0,<2.0