@@ -155,11 +155,9 @@ def _fetch_release_index(module_ctx, release_date, base_url, facts):
155155 return index
156156
157157def _python_interpreters_impl (module_ctx ):
158- has_facts = hasattr (module_ctx , "facts" )
159-
160158 # Facts is a special Bazel type that supports .get() but is not iterable.
161159 # We read from it with .get(key) and build a new dict for output.
162- facts = module_ctx .facts if has_facts else {}
160+ facts = module_ctx .facts
163161
164162 # Track whether the extension is reproducible. Using "latest" as a release
165163 # date makes it non-reproducible since the resolution depends on when it runs.
@@ -259,7 +257,10 @@ def _python_interpreters_impl(module_ctx):
259257 allow_pre_release [major_minor ] = True
260258
261259 if not requested_versions :
262- return _return_metadata (module_ctx , has_facts , facts , is_reproducible )
260+ return module_ctx .extension_metadata (
261+ facts = facts ,
262+ reproducible = is_reproducible ,
263+ )
263264
264265 new_facts = {}
265266 release_indices = {}
@@ -368,7 +369,12 @@ def _python_interpreters_impl(module_ctx):
368369 toolchains = toolchain_entries ,
369370 )
370371
371- return _return_metadata (module_ctx , has_facts , new_facts , is_reproducible )
372+ # Non-reproducible means "latest" was used: signal this to Bazel so it
373+ # warns the user and doesn't cache the extension evaluation.
374+ return module_ctx .extension_metadata (
375+ facts = new_facts ,
376+ reproducible = is_reproducible ,
377+ )
372378
373379def _find_asset (major_minor , platform , runtime_mode , release_dates , release_indices ):
374380 """Find the best asset across releases, preferring newer releases."""
@@ -385,20 +391,6 @@ def _find_asset(major_minor, platform, runtime_mode, release_dates, release_indi
385391 }
386392 return None
387393
388- def _return_metadata (module_ctx , has_facts , facts , is_reproducible ):
389- """Return extension_metadata with facts and reproducibility info.
390-
391- Non-reproducible means "latest" was used: signal this to Bazel so it
392- warns the user and doesn't cache the extension evaluation.
393- """
394- if not has_facts or not hasattr (module_ctx , "extension_metadata" ):
395- return None
396-
397- return module_ctx .extension_metadata (
398- facts = facts ,
399- reproducible = is_reproducible ,
400- )
401-
402394_configure_tag = tag_class (
403395 attrs = {
404396 "base_url" : attr .string (
0 commit comments