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

Function write_readme

constructor/osxpkg.py:71–97  ·  view source on GitHub ↗
(dst, info)

Source from the content-addressed store, hash-verified

69
70
71def write_readme(dst, info):
72 src = join(OSX_DIR, "readme_header.rtf")
73 with open(src) as fi:
74 data = fi.read()
75
76 # This is necessary for when installing on case-sensitive macOS filesystems.
77 data = data.replace("__NAME_LOWER__", info.get("pkg_name", info["name"]).lower())
78 data = data.replace("__NAME__", info["name"])
79 data = data.replace("__VERSION__", info["version"])
80
81 with open(dst, "w") as f:
82 f.write(data)
83
84 all_dists = info["_dists"].copy()
85 for env_info in info.get("_extra_envs_info", {}).values():
86 all_dists += env_info["_dists"]
87 all_dists = list({dist: None for dist in all_dists}) # de-duplicate
88
89 # TODO: Split output by env name
90 for dist in sorted(all_dists):
91 if dist.startswith("_"):
92 continue
93 f.write(
94 "{\\listtext\t\n\\f1 \\uc0\\u8259 \n\\f0 \t}%s %s\\\n"
95 % tuple(dist.rsplit("-", 2)[:2])
96 )
97 f.write("}")
98
99
100def _detect_mimetype(path: str):

Callers 1

modify_xmlFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected