@@ -135,7 +135,7 @@ for a particular version.
135135 },
136136)
137137
138- def _build_config (config , * , platform , compatible_with , target_settings , urls = [], sha256 = "" , ** values ):
138+ def _configure (config , * , platform , compatible_with , target_settings , urls = [], sha256 = "" , ** values ):
139139 """Set the value in the config if the value is provided"""
140140 for key , value in values .items ():
141141 if not value :
@@ -171,12 +171,11 @@ def parse_modules(module_ctx, uv_repository = None):
171171 Returns:
172172 A dictionary for each version of the `uv` to configure.
173173 """
174- config = {}
175-
174+ defaults = {}
176175 for mod in module_ctx .modules :
177176 for default_attr in mod .tags .default :
178- _build_config (
179- config ,
177+ _configure (
178+ defaults ,
180179 version = default_attr .version ,
181180 base_url = default_attr .base_url ,
182181 manifest_filename = default_attr .manifest_filename ,
@@ -189,20 +188,20 @@ def parse_modules(module_ctx, uv_repository = None):
189188 for mod in module_ctx .modules :
190189 last_version = None
191190 for config_attr in mod .tags .configure :
192- last_version = config_attr .version or last_version or config ["version" ]
191+ last_version = config_attr .version or last_version or defaults ["version" ]
193192 if not last_version :
194193 fail ("version must be specified" )
195194
196195 specific_config = versions .setdefault (
197196 last_version ,
198197 {
199- "base_url" : config .get ("base_url" , "" ),
200- "manifest_filename" : config ["manifest_filename" ],
201- "platforms" : dict (config ["platforms" ]), # copy
198+ "base_url" : defaults .get ("base_url" , "" ),
199+ "manifest_filename" : defaults ["manifest_filename" ],
200+ "platforms" : dict (defaults ["platforms" ]), # copy
202201 },
203202 )
204203
205- _build_config (
204+ _configure (
206205 specific_config ,
207206 base_url = config_attr .base_url ,
208207 manifest_filename = config_attr .manifest_filename ,
@@ -235,15 +234,18 @@ def parse_modules(module_ctx, uv_repository = None):
235234 toolchain_labels_by_toolchain = {}
236235 toolchain_compatible_with_by_toolchain = {}
237236 toolchain_target_settings = {}
238-
239237 for version , config in versions .items ():
240238 platforms = config ["platforms" ]
241239
240+ # Use the manually specified urls
242241 urls = {
243242 platform : src
244243 for platform , src in config .get ("urls" , {}).items ()
245244 if src .urls
246245 }
246+
247+ # Or fallback to fetching them from GH manifest file
248+ # Example file: https://github.com/astral-sh/uv/releases/download/0.6.3/dist-manifest.json
247249 if not urls :
248250 urls = _get_tool_urls_from_dist_manifest (
249251 module_ctx ,
@@ -252,7 +254,7 @@ def parse_modules(module_ctx, uv_repository = None):
252254 base_url = config ["base_url" ],
253255 ),
254256 manifest_filename = config ["manifest_filename" ],
255- platforms = sorted (platforms . keys () ),
257+ platforms = sorted (platforms ),
256258 )
257259
258260 result = uv_repositories (
0 commit comments