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

Function get_license

constructor/briefcase.py:156–175  ·  view source on GitHub ↗

Retrieve the specified license as a dict or return a placeholder if not set. If root is specified and the license file is not already RTF, converts it to RTF with a readable font (Segoe UI) instead of relying on Briefcase's default Courier. :param root: Payload directory to write the c

(info, root: Path = None)

Source from the content-addressed store, hash-verified

154
155
156def get_license(info, root: Path = None):
157 """Retrieve the specified license as a dict or return a placeholder if not set.
158
159 If root is specified and the license file is not already RTF, converts it to RTF
160 with a readable font (Segoe UI) instead of relying on Briefcase's default Courier.
161
162 :param root: Payload directory to write the converted RTF file to.
163 """
164 if "license_file" in info:
165 license_path = Path(info["license_file"])
166 # If already RTF or no root to write to, return as-is
167 if license_path.suffix.lower() == ".rtf" or root is None:
168 return {"file": str(license_path)}
169 # Convert txt to rtf with better font
170 rtf_path = root / "LICENSE.rtf"
171 rtf_path.write_text(txt_to_rtf(license_path.read_text(encoding="utf-8")), encoding="utf-8")
172 return {"file": str(rtf_path)}
173
174 placeholder_license = Path(__file__).parent / "nsis" / "placeholder_license.txt"
175 return {"file": str(placeholder_license)} # convert to str for TOML serialization
176
177
178def is_bat_file(file_path: Path) -> bool:

Callers 2

write_pyproject_tomlMethod · 0.85

Calls 2

txt_to_rtfFunction · 0.85
read_textMethod · 0.45

Tested by 1