MCPcopy Create free account
hub / github.com/conda/constructor / write_initial_state_explicit_txt

Function write_initial_state_explicit_txt

constructor/preconda.py:307–326  ·  view source on GitHub ↗

urls is an iterable of tuples with url and md5 values

(info: dict, dst_dir: str, urls: tuple[str, str])

Source from the content-addressed store, hash-verified

305
306
307def write_initial_state_explicit_txt(info: dict, dst_dir: str, urls: tuple[str, str]):
308 """
309 urls is an iterable of tuples with url and md5 values
310 """
311 header = dedent(
312 f"""
313 # This file may be used to create an environment using:
314 # $ conda create --name <env> --file <this file>
315 # platform: {info["_platform"]}
316 @EXPLICIT
317 """
318 ).lstrip()
319 with open(join(dst_dir, "initial-state.explicit.txt"), "w") as envf:
320 envf.write(header)
321 for url, md5 in urls:
322 maybe_different_url = ensure_transmuted_ext(info, url)
323 if maybe_different_url != url: # transmuted, no md5
324 envf.write(f"{maybe_different_url}\n")
325 else:
326 envf.write(f"{url}#{md5}\n")
327
328
329def write_channels_txt(info: dict, dst_dir: str, env_config: dict):

Callers 1

write_filesFunction · 0.85

Calls 1

ensure_transmuted_extFunction · 0.85

Tested by

no test coverage detected