Skip to content

Commit d27119c

Browse files
rd4398claude
andcommitted
refactor: remove stale resolve_source references and deduplicate wheel URL logic
Removes all remaining references to the deprecated resolve_source hook: - sources.py: remove dead code checking for resolve_source override - list_overrides.py: remove from hook scanning list - docs: update references that mentioned resolve_source Also eliminates URL construction duplication in bootstrap_requirement_resolver by using wheels.get_wheel_server_urls() instead of duplicating the logic. Co-Authored-By: Claude Sonnet 4.5 <[email protected]> Signed-off-by: Rohan Devasthale <[email protected]>
1 parent 7b874a4 commit d27119c

5 files changed

Lines changed: 7 additions & 14 deletions

File tree

docs/customization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ source url can be provided directly in settings.yaml. Optionally the
9090
downloaded sdist can be renamed. Both the url and the destination filename
9191
support templating. The only supported template variable are:
9292

93-
- `version` - it is replaced by the version returned by the `resolve_source`
93+
- `version` - it is replaced by the resolved version of the package
9494
- `canonicalized_name` - it is replaced by the canonicalized name of the
9595
package specified in the requirement, specifically it applies `canonicalize_name(req.nam)`
9696

docs/reference/hooks.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ Source hooks
197197
source from a URL.
198198

199199
The arguments are the ``WorkContext``, the ``Requirement`` being
200-
evaluated, version of the package being downloaded, the URL
201-
from which the source can be downloaded as returned by ``resolve_source``,
200+
evaluated, version of the package being downloaded, the download URL,
202201
and the output directory in which the source should be downloaded.
203202

204203
The return value should be a ``pathlib.Path`` file path to the downloaded source.

src/fromager/bootstrap_requirement_resolver.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from packaging.requirements import Requirement
1515
from packaging.version import Version
1616

17-
from . import overrides, resolver
17+
from . import overrides, resolver, wheels
1818
from .dependency_graph import DependencyGraph
1919
from .requirements_file import RequirementType
2020

@@ -153,14 +153,10 @@ def _resolve(
153153

154154
if pre_built:
155155
# Resolve prebuilt wheel
156-
# Get wheel server URLs
157-
wheel_server_urls: list[str] = []
158-
if pbi.wheel_server_url:
159-
wheel_server_urls.append(pbi.wheel_server_url)
160-
else:
161-
if self.ctx.wheel_server_url:
162-
wheel_server_urls.append(self.ctx.wheel_server_url)
163-
wheel_server_urls.append(resolver.PYPI_SERVER_URL)
156+
# Get wheel server URLs (use PyPI as cache/fallback server)
157+
wheel_server_urls = wheels.get_wheel_server_urls(
158+
self.ctx, req, cache_wheel_server_url=resolver.PYPI_SERVER_URL
159+
)
164160

165161
# Try each wheel server until one succeeds
166162
for url in wheel_server_urls:

src/fromager/commands/list_overrides.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def list_overrides(
7777
"prebuilt_wheel",
7878
# from overrides.py, found by searching for find_override_method
7979
"download_source",
80-
"resolve_source",
8180
"get_resolver_provider",
8281
"prepare_source",
8382
"build_sdist",

src/fromager/sources.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def get_source_type(ctx: context.WorkContext, req: Requirement) -> SourceType:
4949
pbi = ctx.package_build_info(req)
5050
if (
5151
overrides.find_override_method(req.name, "download_source")
52-
or overrides.find_override_method(req.name, "resolve_source")
5352
or overrides.find_override_method(req.name, "get_resolver_provider")
5453
or pbi.download_source_url(resolve_template=False)
5554
):

0 commit comments

Comments
 (0)