@@ -32,6 +32,12 @@ bzl_library(
3232    visibility = ["@rules_python//:__subpackages__"], 
3333) 
3434
35+ bzl_library( 
36+     name = "versions_bzl", 
37+     srcs = ["versions.bzl"], 
38+     visibility = ["@rules_python//:__subpackages__"], 
39+ ) 
40+ 
3541{toolchains} 
3642""" 
3743
@@ -74,14 +80,18 @@ INTERPRETER_LABELS = {{
7480{interpreter_labels} 
7581}} 
7682DEFAULT_PYTHON_VERSION = "{default_python_version}" 
77- MINOR_MAPPING = {minor_mapping} 
78- PYTHON_VERSIONS = {python_versions} 
7983""" 
8084
8185_line_for_hub_template  =  """\  
8286     "{name}_host": Label("@{name}_host//:python"),
8387""" 
8488
89+ _versions_bzl_template  =  """ 
90+ DEFAULT_PYTHON_VERSION = "{default_python_version}" 
91+ MINOR_MAPPING = {minor_mapping} 
92+ PYTHON_VERSIONS = {python_versions} 
93+ """ 
94+ 
8595def  _hub_repo_impl (rctx ):
8696    # Create the various toolchain definitions and 
8797    # write them to the BUILD file. 
@@ -107,8 +117,17 @@ def _hub_repo_impl(rctx):
107117    rctx .file (
108118        "interpreters.bzl" ,
109119        _interpreters_bzl_template .format (
120+             # TODO @aignas 2024-09-28: before 1.0 remove the value from here 
110121            default_python_version  =  rctx .attr .default_python_version ,
111122            interpreter_labels  =  interpreter_labels ,
123+         ),
124+         executable  =  False ,
125+     )
126+ 
127+     rctx .file (
128+         "versions.bzl" ,
129+         _versions_bzl_template .format (
130+             default_python_version  =  rctx .attr .default_python_version ,
112131            minor_mapping  =  render .dict (rctx .attr .minor_mapping ),
113132            python_versions  =  rctx .attr .python_versions  or  render .list (sorted ({
114133                v : None 
0 commit comments